mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
13 lines
291 B
TypeScript
13 lines
291 B
TypeScript
import { IncomingMessage } from 'http';
|
|
import auth = require('basic-auth');
|
|
|
|
const loginData = auth(undefined! as IncomingMessage);
|
|
if (loginData) {
|
|
const {name, pass} = loginData;
|
|
}
|
|
|
|
const parsed = auth.parse('Basic QmFzaWM6QXV0aA==');
|
|
if (parsed) {
|
|
const {name, pass} = parsed;
|
|
}
|