@whatwg-node/node-fetch
Advanced tools
Comparing version 0.0.1-alpha-20221005124556-f602970 to 0.0.1-alpha-20221005124650-55319ef
@@ -1,2 +0,2 @@ | ||
import { PonyfillAbortSignal } from "./AbortSignal"; | ||
import { PonyfillAbortSignal } from './AbortSignal'; | ||
export declare class PonyfillAbortController implements AbortController { | ||
@@ -3,0 +3,0 @@ signal: PonyfillAbortSignal; |
/// <reference types="node" /> | ||
import { PonyfillBlob } from './Blob'; | ||
import { Readable } from "stream"; | ||
import { PonyfillFormData } from "./FormData"; | ||
import { PonyfillReadableStream } from "./ReadableStream"; | ||
import { Readable } from 'stream'; | ||
import { PonyfillFormData } from './FormData'; | ||
import { PonyfillReadableStream } from './ReadableStream'; | ||
export declare type BodyPonyfillInit = XMLHttpRequestBodyInit | Readable | PonyfillReadableStream<Uint8Array>; | ||
@@ -7,0 +7,0 @@ export declare class BodyPonyfill implements Body { |
@@ -1,3 +0,3 @@ | ||
import { PonyfillRequest, RequestPonyfillInit } from "./Request"; | ||
import { PonyfillResponse } from "./Response"; | ||
import { PonyfillRequest, RequestPonyfillInit } from './Request'; | ||
import { PonyfillResponse } from './Response'; | ||
export declare const fetchPonyfill: (info: string | PonyfillRequest | URL, init?: RequestPonyfillInit) => Promise<PonyfillResponse>; |
@@ -1,2 +0,2 @@ | ||
import { PonyfillBlob } from "./Blob"; | ||
import { PonyfillBlob } from './Blob'; | ||
export declare class PonyfillFile extends PonyfillBlob implements File { | ||
@@ -3,0 +3,0 @@ name: string; |
25
index.js
@@ -116,3 +116,3 @@ 'use strict'; | ||
readable.destroy(error); | ||
} | ||
}, | ||
}; | ||
@@ -134,3 +134,5 @@ } | ||
read() { | ||
reader.read().then(({ value, done }) => { | ||
reader | ||
.read() | ||
.then(({ value, done }) => { | ||
if (done) { | ||
@@ -142,3 +144,4 @@ this.push(null); | ||
} | ||
}).catch(err => { | ||
}) | ||
.catch(err => { | ||
this.destroy(err); | ||
@@ -149,3 +152,3 @@ }); | ||
reader.cancel(err).then(() => callback(err), callback); | ||
} | ||
}, | ||
}); | ||
@@ -172,3 +175,3 @@ } | ||
} | ||
} | ||
}, | ||
}); | ||
@@ -218,3 +221,3 @@ } | ||
} | ||
pipeThrough({ writable, readable }) { | ||
pipeThrough({ writable, readable, }) { | ||
this.pipeTo(writable); | ||
@@ -299,3 +302,3 @@ return readable; | ||
} | ||
if (Number(i) === (entries.length - 1)) { | ||
if (Number(i) === entries.length - 1) { | ||
controller.enqueue(Buffer.from(`\r\n--${boundary}--\r\n`)); | ||
@@ -308,3 +311,3 @@ } | ||
controller.close(); | ||
} | ||
}, | ||
}); | ||
@@ -539,3 +542,3 @@ } | ||
status: 500, | ||
statusText: 'Internal Server Error' | ||
statusText: 'Internal Server Error', | ||
}); | ||
@@ -550,5 +553,5 @@ return response; | ||
headers: { | ||
location: url | ||
location: url, | ||
}, | ||
status | ||
status, | ||
}); | ||
@@ -555,0 +558,0 @@ } |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.0.1-alpha-20221005124556-f602970", | ||
"version": "0.0.1-alpha-20221005124650-55319ef", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
/// <reference types="node" /> | ||
import { Readable } from "stream"; | ||
import { Readable } from 'stream'; | ||
export declare class PonyfillReadableStream<T> implements ReadableStream<T> { | ||
@@ -12,3 +12,3 @@ readable: Readable; | ||
pipeTo(destination: WritableStream<T>): Promise<void>; | ||
pipeThrough<T2>({ writable, readable }: { | ||
pipeThrough<T2>({ writable, readable, }: { | ||
writable: WritableStream<T>; | ||
@@ -15,0 +15,0 @@ readable: ReadableStream<T2>; |
@@ -1,3 +0,3 @@ | ||
import { BodyPonyfill, BodyPonyfillInit } from "./Body"; | ||
import { PonyfillHeadersInit } from "./Headers"; | ||
import { BodyPonyfill, BodyPonyfillInit } from './Body'; | ||
import { PonyfillHeadersInit } from './Headers'; | ||
export declare type RequestPonyfillInit = Omit<RequestInit, 'body' | 'headers'> & { | ||
@@ -4,0 +4,0 @@ body?: BodyPonyfillInit | null; |
@@ -1,3 +0,3 @@ | ||
import { BodyPonyfill, BodyPonyfillInit } from "./Body"; | ||
import { PonyfillHeadersInit } from "./Headers"; | ||
import { BodyPonyfill, BodyPonyfillInit } from './Body'; | ||
import { PonyfillHeadersInit } from './Headers'; | ||
export declare type ResponsePonyfilInit = Omit<ResponseInit, 'headers'> & { | ||
@@ -4,0 +4,0 @@ url?: string; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50730
1365