-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,716 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Isaac Z. Schlueter and Contributors | ||
Copyright (c) 2016 David Frank | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
--- | ||
|
||
Note: This is a derivative work based on "node-fetch" by David Frank, | ||
modified and distributed under the terms of the MIT license above. | ||
https://github.com/bitinn/node-fetch |
17 changes: 17 additions & 0 deletions
17
node_modules/tuf-js/node_modules/minipass-fetch/lib/abort-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
class AbortError extends Error { | ||
constructor (message) { | ||
super(message) | ||
this.code = 'FETCH_ABORTED' | ||
this.type = 'aborted' | ||
Error.captureStackTrace(this, this.constructor) | ||
} | ||
|
||
get name () { | ||
return 'AbortError' | ||
} | ||
|
||
// don't allow name to be overridden, but don't throw either | ||
set name (s) {} | ||
} | ||
module.exports = AbortError |
97 changes: 97 additions & 0 deletions
97
node_modules/tuf-js/node_modules/minipass-fetch/lib/blob.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
'use strict' | ||
const { Minipass } = require('minipass') | ||
const TYPE = Symbol('type') | ||
const BUFFER = Symbol('buffer') | ||
|
||
class Blob { | ||
constructor (blobParts, options) { | ||
this[TYPE] = '' | ||
|
||
const buffers = [] | ||
let size = 0 | ||
|
||
if (blobParts) { | ||
const a = blobParts | ||
const length = Number(a.length) | ||
for (let i = 0; i < length; i++) { | ||
const element = a[i] | ||
const buffer = element instanceof Buffer ? element | ||
: ArrayBuffer.isView(element) | ||
? Buffer.from(element.buffer, element.byteOffset, element.byteLength) | ||
: element instanceof ArrayBuffer ? Buffer.from(element) | ||
: element instanceof Blob ? element[BUFFER] | ||
: typeof element === 'string' ? Buffer.from(element) | ||
: Buffer.from(String(element)) | ||
size += buffer.length | ||
buffers.push(buffer) | ||
} | ||
} | ||
|
||
this[BUFFER] = Buffer.concat(buffers, size) | ||
|
||
const type = options && options.type !== undefined | ||
&& String(options.type).toLowerCase() | ||
if (type && !/[^\u0020-\u007E]/.test(type)) { | ||
this[TYPE] = type | ||
} | ||
} | ||
|
||
get size () { | ||
return this[BUFFER].length | ||
} | ||
|
||
get type () { | ||
return this[TYPE] | ||
} | ||
|
||
text () { | ||
return Promise.resolve(this[BUFFER].toString()) | ||
} | ||
|
||
arrayBuffer () { | ||
const buf = this[BUFFER] | ||
const off = buf.byteOffset | ||
const len = buf.byteLength | ||
const ab = buf.buffer.slice(off, off + len) | ||
return Promise.resolve(ab) | ||
} | ||
|
||
stream () { | ||
return new Minipass().end(this[BUFFER]) | ||
} | ||
|
||
slice (start, end, type) { | ||
const size = this.size | ||
const relativeStart = start === undefined ? 0 | ||
: start < 0 ? Math.max(size + start, 0) | ||
: Math.min(start, size) | ||
const relativeEnd = end === undefined ? size | ||
: end < 0 ? Math.max(size + end, 0) | ||
: Math.min(end, size) | ||
const span = Math.max(relativeEnd - relativeStart, 0) | ||
|
||
const buffer = this[BUFFER] | ||
const slicedBuffer = buffer.slice( | ||
relativeStart, | ||
relativeStart + span | ||
) | ||
const blob = new Blob([], { type }) | ||
blob[BUFFER] = slicedBuffer | ||
return blob | ||
} | ||
|
||
get [Symbol.toStringTag] () { | ||
return 'Blob' | ||
} | ||
|
||
static get BUFFER () { | ||
return BUFFER | ||
} | ||
} | ||
|
||
Object.defineProperties(Blob.prototype, { | ||
size: { enumerable: true }, | ||
type: { enumerable: true }, | ||
}) | ||
|
||
module.exports = Blob |
Oops, something went wrong.