mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #31345 from BendingBender/base64-async
Add types for base64-async
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import b64 = require('base64-async');
|
||||
import * as fs from 'fs';
|
||||
|
||||
const buffer: Buffer = fs.readFileSync('somehugefile.jpg');
|
||||
const b64String = 'aGkgbXVt...';
|
||||
|
||||
b64.encode(buffer).then(b64String => {
|
||||
b64String; // $ExpectType string
|
||||
});
|
||||
b64.encode(buffer, { chunkSize: 10 }).then(b64String => {
|
||||
b64String; // $ExpectType string
|
||||
});
|
||||
|
||||
b64.decode(b64String).then(buffer => {
|
||||
buffer; // $ExpectType Buffer
|
||||
});
|
||||
b64.decode(b64String, { chunkSize: 10 }).then(buffer => {
|
||||
buffer; // $ExpectType Buffer
|
||||
});
|
||||
|
||||
b64(buffer); // $ExpectType Promise<string>
|
||||
b64(buffer, { chunkSize: 10 }); // $ExpectType Promise<string>
|
||||
b64(b64String); // $ExpectType Promise<Buffer>
|
||||
b64(b64String, { chunkSize: 10 }); // $ExpectType Promise<Buffer>
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for base64-async 2.1
|
||||
// Project: https://github.com/lukechilds/base64-async
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = base64Async;
|
||||
|
||||
declare function base64Async(input: Buffer, options?: base64Async.Options): Promise<string>;
|
||||
declare function base64Async(input: string, options?: base64Async.Options): Promise<Buffer>;
|
||||
|
||||
declare namespace base64Async {
|
||||
function encode(input: Buffer, options?: Options): Promise<string>;
|
||||
function decode(input: string, options?: Options): Promise<Buffer>;
|
||||
|
||||
interface Options {
|
||||
chunkSize?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"base64-async-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user