TheDesk
This commit is contained in:
20
node_modules/unused-filename/index.js
generated
vendored
Normal file
20
node_modules/unused-filename/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
const pathExists = require('path-exists');
|
||||
const modifyFilename = require('modify-filename');
|
||||
|
||||
const incrementer = fp => {
|
||||
let i = 0;
|
||||
return () => modifyFilename(fp, (filename, ext) => `${filename} (${++i})${ext}`);
|
||||
};
|
||||
|
||||
module.exports = fp => {
|
||||
const getFp = incrementer(fp);
|
||||
const find = newFp => pathExists(newFp).then(x => x ? find(getFp()) : newFp);
|
||||
return find(fp);
|
||||
};
|
||||
|
||||
module.exports.sync = fp => {
|
||||
const getFp = incrementer(fp);
|
||||
const find = newFp => pathExists.sync(newFp) ? find(getFp()) : newFp;
|
||||
return find(fp);
|
||||
};
|
21
node_modules/unused-filename/license
generated
vendored
Normal file
21
node_modules/unused-filename/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
111
node_modules/unused-filename/package.json
generated
vendored
Normal file
111
node_modules/unused-filename/package.json
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "unused-filename@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "unused-filename",
|
||||
"name": "unused-filename",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\node_modules\\electron-dl"
|
||||
]
|
||||
],
|
||||
"_from": "unused-filename@>=1.0.0 <2.0.0",
|
||||
"_id": "unused-filename@1.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/unused-filename",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/unused-filename-1.0.0.tgz_1494950679307_0.34259403264150023"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "unused-filename@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "unused-filename",
|
||||
"name": "unused-filename",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-dl"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-1.0.0.tgz",
|
||||
"_shasum": "d340880f71ae2115ebaa1325bef05cc6684469c6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "unused-filename@^1.0.0",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\electron-dl",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/unused-filename/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"modify-filename": "^1.1.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"description": "Get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "d340880f71ae2115ebaa1325bef05cc6684469c6",
|
||||
"tarball": "https://registry.npmjs.org/unused-filename/-/unused-filename-1.0.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "e58bdb5e6d81af48439c9f9b04f5ee9d6aaac89c",
|
||||
"homepage": "https://github.com/sindresorhus/unused-filename#readme",
|
||||
"keywords": [
|
||||
"unused",
|
||||
"filename",
|
||||
"filepath",
|
||||
"file",
|
||||
"name",
|
||||
"available",
|
||||
"safe",
|
||||
"unique",
|
||||
"usable",
|
||||
"filesystem",
|
||||
"fs",
|
||||
"exists",
|
||||
"path"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "unused-filename",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/unused-filename.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
56
node_modules/unused-filename/readme.md
generated
vendored
Normal file
56
node_modules/unused-filename/readme.md
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# unused-filename [](https://travis-ci.org/sindresorhus/unused-filename)
|
||||
|
||||
> Get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`
|
||||
|
||||
Useful for safely writing, copying, moving files without overwriting existing files.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save unused-filename
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
.
|
||||
├── rainbow (1).txt
|
||||
├── rainbow.txt
|
||||
└── unicorn.txt
|
||||
```
|
||||
|
||||
```js
|
||||
const unusedFilename = require('unused-filename');
|
||||
|
||||
unusedFilename('rainbow.txt').then(filename => {
|
||||
console.log(filename);
|
||||
//=> 'rainbow (2).txt'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### unusedFilename(filepath)
|
||||
|
||||
Returns a `Promise<string>`.
|
||||
|
||||
### unusedFilename.sync(filepath)
|
||||
|
||||
Returns a `string`.
|
||||
|
||||
#### filepath
|
||||
|
||||
Type: `string`
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [filenamify](https://github.com/sindresorhus/filenamify) - Convert a string to a valid safe filename
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Reference in New Issue
Block a user