Commit 2da8f66f authored by Utkarsh Gupta's avatar Utkarsh Gupta

New upstream version 0.0.33

parent bc968401
engines:
eslint:
enabled: true
channel: "eslint-3"
exclude_paths:
- "docs/"
module.exports = {
"env": {
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
};
## Operating System
- [ ] Linux
- [ ] Windows 7
- [ ] Windows 10
- [ ] MacOS
- other:
## NodeJS Version
- [ ] 0.x
- [ ] 4.x
- [ ] 6.x
- [ ] 7.x
- other:
## Tmp Version
TBD:Enter tmp version here
## Expected Behavior
TBD:What have you expected tmp to do?
## Experienced Behavior
TBD:What did actually happen?
node_modules/
.idea/
.*.swp
{
"opts": {
"destination": "docs",
"readme": "README.md"
},
"source": {
"include": ["lib"],
"includePattern": ".+\\.js$",
"excludePattern": ""
},
"plugins": [],
"templates": {
"default": {
"outputSourceFiles": true
}
}
}
......@@ -23,6 +23,7 @@ node_js:
- "5.11"
- "6.0"
- "6.1"
- "7"
- "node"
sudo: false
cache:
......
......@@ -5,6 +5,8 @@ A simple temporary file and directory creator for [node.js.][1]
[![Build Status](https://travis-ci.org/raszi/node-tmp.svg?branch=master)](https://travis-ci.org/raszi/node-tmp)
[![Dependencies](https://david-dm.org/raszi/node-tmp.svg)](https://david-dm.org/raszi/node-tmp)
[![npm version](https://badge.fury.io/js/tmp.svg)](https://badge.fury.io/js/tmp)
[![API documented](https://img.shields.io/badge/API-documented-brightgreen.svg)](https://raszi.github.io/node-tmp/)
[![Known Vulnerabilities](https://snyk.io/test/npm/tmp/badge.svg)](https://snyk.io/test/npm/tmp)
## About
......@@ -12,7 +14,8 @@ This is a [widely used library][2] to create temporary files and directories
in a [node.js][1] environment.
Tmp offers both an asynchronous and a synchronous API. For all API calls, all
the parameters are optional.
the parameters are optional. There also exists a promisified version of the
API, see (5) under references below.
Tmp uses crypto for determining random file names, or, when using templates,
a six letter random identifier. And just in case that you do not have that much
......@@ -29,6 +32,8 @@ npm install tmp
## Usage
Please also check [API docs][4].
### Asynchronous file creation
Simple temporary file creation, the file will be closed and unlinked on process exit.
......@@ -39,8 +44,8 @@ var tmp = require('tmp');
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err;
console.log("File: ", path);
console.log("Filedescriptor: ", fd);
console.log('File: ', path);
console.log('Filedescriptor: ', fd);
// If we don't need the file anymore we could manually call the cleanupCallback
// But that is not necessary if we didn't pass the keep option because the library
......@@ -57,8 +62,8 @@ A synchronous version of the above.
var tmp = require('tmp');
var tmpobj = tmp.fileSync();
console.log("File: ", tmpobj.name);
console.log("Filedescriptor: ", tmpobj.fd);
console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd);
// If we don't need the file anymore we could manually call the removeCallback
// But that is not necessary if we didn't pass the keep option because the library
......@@ -82,7 +87,7 @@ var tmp = require('tmp');
tmp.dir(function _tempDirCreated(err, path, cleanupCallback) {
if (err) throw err;
console.log("Dir: ", path);
console.log('Dir: ', path);
// Manual cleanup
cleanupCallback();
......@@ -100,7 +105,7 @@ A synchronous version of the above.
var tmp = require('tmp');
var tmpobj = tmp.dirSync();
console.log("Dir: ", tmpobj.name);
console.log('Dir: ', tmpobj.name);
// Manual cleanup
tmpobj.removeCallback();
```
......@@ -120,7 +125,7 @@ var tmp = require('tmp');
tmp.tmpName(function _tempNameGenerated(err, path) {
if (err) throw err;
console.log("Created temporary filename: ", path);
console.log('Created temporary filename: ', path);
});
```
......@@ -132,7 +137,7 @@ A synchronous version of the above.
var tmp = require('tmp');
var name = tmp.tmpNameSync();
console.log("Created temporary filename: ", name);
console.log('Created temporary filename: ', name);
```
## Advanced usage
......@@ -147,8 +152,8 @@ var tmp = require('tmp');
tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
if (err) throw err;
console.log("File: ", path);
console.log("Filedescriptor: ", fd);
console.log('File: ', path);
console.log('Filedescriptor: ', fd);
});
```
......@@ -160,8 +165,8 @@ A synchronous version of the above.
var tmp = require('tmp');
var tmpobj = tmp.fileSync({ mode: 0644, prefix: 'prefix-', postfix: '.txt' });
console.log("File: ", tmpobj.name);
console.log("Filedescriptor: ", tmpobj.fd);
console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd);
```
### Controlling the Descriptor
......@@ -213,7 +218,7 @@ var tmp = require('tmp');
tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
if (err) throw err;
console.log("Dir: ", path);
console.log('Dir: ', path);
});
```
......@@ -225,7 +230,7 @@ Again, a synchronous version of the above.
var tmp = require('tmp');
var tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
console.log("Dir: ", tmpobj.name);
console.log('Dir: ', tmpobj.name);
```
### mkstemp like, asynchronously
......@@ -238,7 +243,7 @@ var tmp = require('tmp');
tmp.dir({ template: '/tmp/tmp-XXXXXX' }, function _tempDirCreated(err, path) {
if (err) throw err;
console.log("Dir: ", path);
console.log('Dir: ', path);
});
```
......@@ -250,7 +255,7 @@ This will behave similarly to the asynchronous version.
var tmp = require('tmp');
var tmpobj = tmp.dirSync({ template: '/tmp/tmp-XXXXXX' });
console.log("Dir: ", tmpobj.name);
console.log('Dir: ', tmpobj.name);
```
### Asynchronous filename generation
......@@ -263,7 +268,7 @@ var tmp = require('tmp');
tmp.tmpName({ template: '/tmp/tmp-XXXXXX' }, function _tempNameGenerated(err, path) {
if (err) throw err;
console.log("Created temporary filename: ", path);
console.log('Created temporary filename: ', path);
});
```
......@@ -274,7 +279,7 @@ The `tmpNameSync()` function works similarly to `tmpName()`.
```javascript
var tmp = require('tmp');
var tmpname = tmp.tmpNameSync({ template: '/tmp/tmp-XXXXXX' });
console.log("Created temporary filename: ", tmpname);
console.log('Created temporary filename: ', tmpname);
```
## Graceful cleanup
......@@ -305,3 +310,5 @@ All options are optional :)
[1]: http://nodejs.org/
[2]: https://www.npmjs.com/browse/depended/tmp
[3]: http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html
[4]: https://raszi.github.io/node-tmp/
[5]: https://github.com/benjamingr/tmp-promise
# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
matrix:
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "7"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm test
build: off
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="tmpDir"><span class="type-signature">(constant) </span>tmpDir<span class="type-signature"> :string</span></h4>
<div class="description">
The temporary directory.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="dir"><span class="type-signature"></span>dir<span class="signature">(options, callback<span class="signature-attributes">nullable</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Creates a temporary directory.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Options">Options</a></span>
|
<span class="param-type"><a href="global.html#dirCallback">dirCallback</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">the options or the callback function</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="global.html#dirCallback">dirCallback</a></span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line319">line 319</a>
</li></ul></dd>
</dl>
<h4 class="name" id="dirSync"><span class="type-signature"></span>dirSync<span class="signature">(options)</span><span class="type-signature"> &rarr; {<a href="global.html#DirSyncObject">DirSyncObject</a>}</span></h4>
<div class="description">
Synchronous version of dir.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Options">Options</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">