mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-01 11:50:54 +08:00
Merge pull request #5039 from stpettersens/master
Type definitions and tests for magic-number
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="magic-number.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import magic = require('magic-number');
|
||||
|
||||
var buffer: any = new Buffer(100);
|
||||
buffer.write('7z', 'binary');
|
||||
fs.writeFile('test.love', buffer, function(err: any) {
|
||||
console.log(magic.detectFile('test.love')); // => 'application/7z-x-compressed'
|
||||
fs.unlinkSync('test.love');
|
||||
});
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for magic-number
|
||||
// Project: https://github.com/stpettersens/node-magic-number
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "magic-number" {
|
||||
export function detectFile(file: string): string;
|
||||
}
|
||||
Reference in New Issue
Block a user