{ "_args": [ [ { "raw": "tmp@^0.0.33", "scope": null, "escapedName": "tmp", "name": "tmp", "rawSpec": "^0.0.33", "spec": ">=0.0.33 <0.0.34", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/external-editor" ] ], "_from": "tmp@>=0.0.33 <0.0.34", "_id": "tmp@0.0.33", "_inCache": true, "_location": "/tmp", "_nodeVersion": "8.3.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/tmp-0.0.33.tgz_1502530218606_0.07867415226064622" }, "_npmUser": { "name": "raszi", "email": "npm@spam.raszi.hu" }, "_npmVersion": "5.3.0", "_phantomChildren": {}, "_requested": { "raw": "tmp@^0.0.33", "scope": null, "escapedName": "tmp", "name": "tmp", "rawSpec": "^0.0.33", "spec": ">=0.0.33 <0.0.34", "type": "range" }, "_requiredBy": [ "/external-editor" ], "_resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "_shasum": "6d34335889768d21b2bcda0aa277ced3b1bfadf9", "_shrinkwrap": null, "_spec": "tmp@^0.0.33", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/external-editor", "author": { "name": "KARASZI István", "email": "github@spam.raszi.hu", "url": "http://raszi.hu/" }, "bugs": { "url": "http://github.com/raszi/node-tmp/issues" }, "dependencies": { "os-tmpdir": "~1.0.2" }, "description": "Temporary file and directory creator", "devDependencies": { "vows": "~0.7.0" }, "directories": {}, "dist": { "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "shasum": "6d34335889768d21b2bcda0aa277ced3b1bfadf9", "tarball": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz" }, "engines": { "node": ">=0.6.0" }, "files": [ "lib/" ], "gitHead": "0900dd5b112ac7a482e4bdf3cb002bfe1b3acf77", "homepage": "http://github.com/raszi/node-tmp", "keywords": [ "temporary", "tmp", "temp", "tempdir", "tempfile", "tmpdir", "tmpfile" ], "license": "MIT", "main": "lib/tmp.js", "maintainers": [ { "name": "raszi", "email": "npm@spam.raszi.hu" } ], "name": "tmp", "optionalDependencies": {}, "readme": "# Tmp\n\nA simple temporary file and directory creator for [node.js.][1]\n\n[![Build Status](https://travis-ci.org/raszi/node-tmp.svg?branch=master)](https://travis-ci.org/raszi/node-tmp)\n[![Dependencies](https://david-dm.org/raszi/node-tmp.svg)](https://david-dm.org/raszi/node-tmp)\n[![npm version](https://badge.fury.io/js/tmp.svg)](https://badge.fury.io/js/tmp)\n[![API documented](https://img.shields.io/badge/API-documented-brightgreen.svg)](https://raszi.github.io/node-tmp/)\n[![Known Vulnerabilities](https://snyk.io/test/npm/tmp/badge.svg)](https://snyk.io/test/npm/tmp)\n\n## About\n\nThis is a [widely used library][2] to create temporary files and directories\nin a [node.js][1] environment.\n\nTmp offers both an asynchronous and a synchronous API. For all API calls, all\nthe parameters are optional. There also exists a promisified version of the\nAPI, see (5) under references below.\n\nTmp uses crypto for determining random file names, or, when using templates,\na six letter random identifier. And just in case that you do not have that much\nentropy left on your system, Tmp will fall back to pseudo random numbers.\n\nYou can set whether you want to remove the temporary file on process exit or\nnot, and the destination directory can also be set.\n\n## How to install\n\n```bash\nnpm install tmp\n```\n\n## Usage\n\nPlease also check [API docs][4].\n\n### Asynchronous file creation\n\nSimple temporary file creation, the file will be closed and unlinked on process exit.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {\n if (err) throw err;\n\n console.log('File: ', path);\n console.log('Filedescriptor: ', fd);\n \n // If we don't need the file anymore we could manually call the cleanupCallback\n // But that is not necessary if we didn't pass the keep option because the library\n // will clean after itself.\n cleanupCallback();\n});\n```\n\n### Synchronous file creation\n\nA synchronous version of the above.\n\n```javascript\nvar tmp = require('tmp');\n\nvar tmpobj = tmp.fileSync();\nconsole.log('File: ', tmpobj.name);\nconsole.log('Filedescriptor: ', tmpobj.fd);\n \n// If we don't need the file anymore we could manually call the removeCallback\n// But that is not necessary if we didn't pass the keep option because the library\n// will clean after itself.\ntmpobj.removeCallback();\n```\n\nNote that this might throw an exception if either the maximum limit of retries\nfor creating a temporary name fails, or, in case that you do not have the permission\nto write to the directory where the temporary file should be created in.\n\n### Asynchronous directory creation\n\nSimple temporary directory creation, it will be removed on process exit.\n\nIf the directory still contains items on process exit, then it won't be removed.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.dir(function _tempDirCreated(err, path, cleanupCallback) {\n if (err) throw err;\n\n console.log('Dir: ', path);\n \n // Manual cleanup\n cleanupCallback();\n});\n```\n\nIf you want to cleanup the directory even when there are entries in it, then\nyou can pass the `unsafeCleanup` option when creating it.\n\n### Synchronous directory creation\n\nA synchronous version of the above.\n\n```javascript\nvar tmp = require('tmp');\n\nvar tmpobj = tmp.dirSync();\nconsole.log('Dir: ', tmpobj.name);\n// Manual cleanup\ntmpobj.removeCallback();\n```\n\nNote that this might throw an exception if either the maximum limit of retries\nfor creating a temporary name fails, or, in case that you do not have the permission\nto write to the directory where the temporary directory should be created in.\n\n### Asynchronous filename generation\n\nIt is possible with this library to generate a unique filename in the specified\ndirectory.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.tmpName(function _tempNameGenerated(err, path) {\n if (err) throw err;\n\n console.log('Created temporary filename: ', path);\n});\n```\n\n### Synchronous filename generation\n\nA synchronous version of the above.\n\n```javascript\nvar tmp = require('tmp');\n\nvar name = tmp.tmpNameSync();\nconsole.log('Created temporary filename: ', name);\n```\n\n## Advanced usage\n\n### Asynchronous file creation\n\nCreates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {\n if (err) throw err;\n\n console.log('File: ', path);\n console.log('Filedescriptor: ', fd);\n});\n```\n\n### Synchronous file creation\n\nA synchronous version of the above.\n\n```javascript\nvar tmp = require('tmp');\n\nvar tmpobj = tmp.fileSync({ mode: 0644, prefix: 'prefix-', postfix: '.txt' });\nconsole.log('File: ', tmpobj.name);\nconsole.log('Filedescriptor: ', tmpobj.fd);\n```\n\n### Controlling the Descriptor\n\nAs a side effect of creating a unique file `tmp` gets a file descriptor that is\nreturned to the user as the `fd` parameter. The descriptor may be used by the\napplication and is closed when the `removeCallback` is invoked.\n\nIn some use cases the application does not need the descriptor, needs to close it\nwithout removing the file, or needs to remove the file without closing the\ndescriptor. Two options control how the descriptor is managed:\n\n* `discardDescriptor` - if `true` causes `tmp` to close the descriptor after the file\n is created. In this case the `fd` parameter is undefined.\n* `detachDescriptor` - if `true` causes `tmp` to return the descriptor in the `fd`\n parameter, but it is the application's responsibility to close it when it is no\n longer needed.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {\n if (err) throw err;\n // fd will be undefined, allowing application to use fs.createReadStream(path)\n // without holding an unused descriptor open.\n});\n```\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {\n if (err) throw err;\n\n cleanupCallback();\n // Application can store data through fd here; the space used will automatically\n // be reclaimed by the operating system when the descriptor is closed or program\n // terminates.\n});\n```\n\n### Asynchronous directory creation\n\nCreates a directory with mode `0755`, prefix will be `myTmpDir_`.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {\n if (err) throw err;\n\n console.log('Dir: ', path);\n});\n```\n\n### Synchronous directory creation\n\nAgain, a synchronous version of the above.\n\n```javascript\nvar tmp = require('tmp');\n\nvar tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });\nconsole.log('Dir: ', tmpobj.name);\n```\n\n### mkstemp like, asynchronously\n\nCreates a new temporary directory with mode `0700` and filename like `/tmp/tmp-nk2J1u`.\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.dir({ template: '/tmp/tmp-XXXXXX' }, function _tempDirCreated(err, path) {\n if (err) throw err;\n\n console.log('Dir: ', path);\n});\n```\n\n### mkstemp like, synchronously\n\nThis will behave similarly to the asynchronous version.\n\n```javascript\nvar tmp = require('tmp');\n\nvar tmpobj = tmp.dirSync({ template: '/tmp/tmp-XXXXXX' });\nconsole.log('Dir: ', tmpobj.name);\n```\n\n### Asynchronous filename generation\n\nThe `tmpName()` function accepts the `prefix`, `postfix`, `dir`, etc. parameters also:\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, function _tempNameGenerated(err, path) {\n if (err) throw err;\n\n console.log('Created temporary filename: ', path);\n});\n```\n\n### Synchronous filename generation\n\nThe `tmpNameSync()` function works similarly to `tmpName()`.\n\n```javascript\nvar tmp = require('tmp');\nvar tmpname = tmp.tmpNameSync({ template: '/tmp/tmp-XXXXXX' });\nconsole.log('Created temporary filename: ', tmpname);\n```\n\n## Graceful cleanup\n\nOne may want to cleanup the temporary files even when an uncaught exception\noccurs. To enforce this, you can call the `setGracefulCleanup()` method:\n\n```javascript\nvar tmp = require('tmp');\n\ntmp.setGracefulCleanup();\n```\n\n## Options\n\nAll options are optional :)\n\n * `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation\n * `prefix`: the optional prefix, fallbacks to `tmp-` if not provided\n * `postfix`: the optional postfix, fallbacks to `.tmp` on file creation\n * `template`: [`mkstemp`][3] like filename template, no default\n * `dir`: the optional temporary directory, fallbacks to system default (guesses from environment)\n * `tries`: how many times should the function try to get a unique filename before giving up, default `3`\n * `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`, means delete\n * Please keep in mind that it is recommended in this case to call the provided `cleanupCallback` function manually.\n * `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`\n\n[1]: http://nodejs.org/\n[2]: https://www.npmjs.com/browse/depended/tmp\n[3]: http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html\n[4]: https://raszi.github.io/node-tmp/\n[5]: https://github.com/benjamingr/tmp-promise\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/raszi/node-tmp.git" }, "scripts": { "doc": "jsdoc -c .jsdoc.json", "test": "vows test/*-test.js" }, "version": "0.0.33" }