mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Create magic-number-tests.ts
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');
|
||||
});
|
||||
Reference in New Issue
Block a user