mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@hapi/b64] Add types for @hapi/b64 (#41615)
This commit is contained in:
parent
9ea1c21a77
commit
6001fc7115
17
types/hapi__b64/hapi__b64-tests.ts
Normal file
17
types/hapi__b64/hapi__b64-tests.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import * as B64 from '@hapi/b64';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const stream = fs.createReadStream('package.json');
|
||||
const encoder = new B64.Encoder();
|
||||
const decoder = new B64.Decoder();
|
||||
|
||||
stream.pipe(encoder).pipe(process.stdout);
|
||||
stream.pipe(decoder).pipe(process.stdout);
|
||||
|
||||
B64.decode(Buffer.from('aHR0cHM6Ly9naXRodWIuY29t')); // $ExpectType Buffer
|
||||
B64.encode(Buffer.from('https://github.com')); // $ExpectType Buffer
|
||||
|
||||
B64.base64urlDecode('aHR0cHM6Ly9naXRodWIuY29t'); // $ExpectType string
|
||||
B64.base64urlDecode('aHR0cHM6Ly9naXRodWIuY29t', 'ascii'); // $ExpectType string
|
||||
B64.base64urlDecode('aHR0cHM6Ly9naXRodWIuY29t', 'buffer'); // $ExpectType Buffer
|
||||
B64.base64urlEncode('https://github.com'); // $ExpectType string
|
||||
19
types/hapi__b64/index.d.ts
vendored
Normal file
19
types/hapi__b64/index.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Type definitions for @hapi/b64 5.0
|
||||
// Project: https://github.com/hapijs/b64#readme
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types='node' />
|
||||
|
||||
import * as stream from 'stream';
|
||||
|
||||
export class Decoder extends stream.Transform {}
|
||||
export class Encoder extends stream.Transform {}
|
||||
|
||||
export function decode(buffer: Buffer): Buffer;
|
||||
export function encode(buffer: Buffer): Buffer;
|
||||
|
||||
export function base64urlEncode(value: string | Buffer, encoding?: BufferEncoding): string;
|
||||
|
||||
export function base64urlDecode(value: string, encoding?: BufferEncoding): string;
|
||||
export function base64urlDecode(value: string, encoding: 'buffer'): Buffer;
|
||||
28
types/hapi__b64/tsconfig.json
Normal file
28
types/hapi__b64/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@hapi/b64": [
|
||||
"hapi__b64"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"hapi__b64-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/hapi__b64/tslint.json
Normal file
1
types/hapi__b64/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user