mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-27 12:21:19 +08:00
Add definitions for node-tmp library
This commit is contained in:
1 parent
2cc4331067
commit
30cbb6f4d0
2 files changed
+79
No files matched your search
@@ -0,0 +1,46 @@
|
||||
/// <reference path="tmp.d.ts" />
|
||||
import tmp = require('tmp');
|
||||
|
||||
tmp.file((err, path, fd, cleanupCallback) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("File: ", path);
|
||||
console.log("Filedescriptor: ", fd);
|
||||
|
||||
cleanupCallback();
|
||||
});
|
||||
|
||||
tmp.dir((err, path, cleanupCallback) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("Dir: ", path);
|
||||
|
||||
cleanupCallback();
|
||||
});
|
||||
|
||||
tmp.tmpName((err, path) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("Created temporary filename: ", path);
|
||||
});
|
||||
|
||||
tmp.file({ mode: 644, prefix: 'prefix-', postfix: '.txt' }, (err, path, fd) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("File: ", path);
|
||||
console.log("Filedescriptor: ", fd);
|
||||
});
|
||||
|
||||
tmp.dir({ mode: 750, prefix: 'myTmpDir_' }, (err, path) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("Dir: ", path);
|
||||
});
|
||||
|
||||
tmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, (err, path) => {
|
||||
if (err) throw err;
|
||||
|
||||
console.log("Created temporary filename: ", path);
|
||||
});
|
||||
|
||||
tmp.setGracefulCleanup();
|
||||
Reference in new issue
Block a user