mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
s3-upload-stream typing
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for s3-upload-stream
|
||||
// Project: https://github.com/nathanpeck/s3-upload-stream
|
||||
// Definitions by: Joshua DeVinney <https://github.com/geoffreak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference path="../aws-sdk/index.d.ts" />
|
||||
|
||||
import * as stream from 'stream';
|
||||
import * as AWS from 'aws-sdk';
|
||||
|
||||
interface IS3Stream {
|
||||
(client: AWS.S3): IS3StreamUploader
|
||||
}
|
||||
|
||||
interface IS3StreamUploader {
|
||||
upload(destinationDetails: AWS.s3.PutObjectRequest, sessionDetails?: any): IS3WriteStream;
|
||||
}
|
||||
|
||||
interface IS3WriteStream extends stream.Writable {
|
||||
maxPartSize(sizeInBytes: number): void;
|
||||
concurrentParts(numberOfParts: number): void;
|
||||
}
|
||||
|
||||
declare var s3Stream: IS3Stream;
|
||||
export = s3Stream;
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference path="../aws-sdk/index.d.ts" />
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as S3Stream from 's3-upload-stream';
|
||||
import * as AWS from 'aws-sdk';
|
||||
|
||||
var s3Stream = S3Stream(new AWS.S3());
|
||||
|
||||
var read = fs.createReadStream('/path/to/a/file');
|
||||
var upload = s3Stream.upload({
|
||||
Bucket: "bucket-name",
|
||||
Key: "key-name",
|
||||
ACL: "public-read",
|
||||
StorageClass: "REDUCED_REDUNDANCY",
|
||||
ContentType: "binary/octet-stream"
|
||||
});
|
||||
|
||||
upload.concurrentParts(5);
|
||||
|
||||
read.pipe(upload);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"s3-upload-stream-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user