Adding @types/s3-streams (#46016)

* Adding @types/s3-streams

* Use LTS node on Actions

Co-authored-by: Andrew Branch <andrew@wheream.io>
This commit is contained in:
Carl Fürstenberg 2020-08-10 23:56:30 +02:00 committed by GitHub
parent c1375f8e7e
commit 08496fde74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 0 deletions

28
types/s3-streams/index.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
// Type definitions for s3-streams 0.4
// Project: https://github.com/izaakschroeder/s3-streams
// Definitions by: Carl Fürstenberg <https://github.com/azatoth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { S3 } from 'aws-sdk';
import { Readable, Writable } from 'stream';
export interface StreamOptions {
/**
* Number of bytes to read or write before emitting a chunk to the stream.
* Must be above 5MB for {@link WriteStream}
*
* @default 4MB for {@link ReadStream}
* @default 10MB for {@link WriteStream}
*/
highWaterMark?: number;
}
export class ReadStream extends Readable {
constructor(client: S3, options: S3.GetObjectRequest, streamOptions?: StreamOptions);
}
export class WriteStream extends Writable {
constructor(client: S3, options: S3.CreateMultipartUploadRequest, streamOptions?: StreamOptions);
}

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"aws-sdk": "^2.713.0"
}
}

View File

@ -0,0 +1,23 @@
import * as AWS from 'aws-sdk';
import * as S3S from 's3-streams';
const s3 = new AWS.S3();
const ws = new S3S.WriteStream(
s3,
{
Bucket: 'my-bucket',
Key: 'my-key',
},
{ highWaterMark: 42 },
);
const rs = new S3S.ReadStream(
s3,
{
Bucket: 'my-bucket',
Key: 'my-key',
},
{ highWaterMark: 42 },
);
rs.pipe(ws);

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"s3-streams-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }