mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 21:47:35 +00:00
superagent - attach blobs to request.
This commit is contained in:
parent
df04a6e201
commit
eab5bd9833
2
types/superagent/index.d.ts
vendored
2
types/superagent/index.d.ts
vendored
@ -94,7 +94,7 @@ declare namespace request {
|
||||
interface Request extends Promise<Response> /* extends NodeJS.WritableStream */ {
|
||||
abort(): void;
|
||||
accept(type: string): this;
|
||||
attach(field: string, file: string, filename?: string): this;
|
||||
attach(field: string, file: string | Blob, filename?: string): this;
|
||||
auth(user: string, name: string): this;
|
||||
buffer(val?: boolean): this;
|
||||
clearTimeout(): this;
|
||||
|
||||
@ -262,11 +262,13 @@ stream.pipe(req);
|
||||
})();
|
||||
|
||||
// Attaching files
|
||||
const blob: Blob = new File([], 'thor.png');
|
||||
request
|
||||
.post('/upload')
|
||||
.attach('avatar', 'path/to/tobi.png', 'user.png')
|
||||
.attach('image', 'path/to/loki.png')
|
||||
.attach('file', 'path/to/jane.png')
|
||||
.attach('blob', blob)
|
||||
.end(callback);
|
||||
|
||||
// Field values
|
||||
|
||||
Loading…
Reference in New Issue
Block a user