diff options
Diffstat (limited to 'desktop/node_modules/junk')
-rw-r--r-- | desktop/node_modules/junk/index.d.ts | 40 | ||||
-rw-r--r-- | desktop/node_modules/junk/index.js | 39 | ||||
-rw-r--r-- | desktop/node_modules/junk/license | 9 | ||||
-rw-r--r-- | desktop/node_modules/junk/package.json | 42 | ||||
-rw-r--r-- | desktop/node_modules/junk/readme.md | 51 |
5 files changed, 181 insertions, 0 deletions
diff --git a/desktop/node_modules/junk/index.d.ts b/desktop/node_modules/junk/index.d.ts new file mode 100644 index 0000000..46dbded --- /dev/null +++ b/desktop/node_modules/junk/index.d.ts @@ -0,0 +1,40 @@ +declare const junk: { + /** + Returns `true` if `filename` matches a junk file. + */ + is(filename: string): boolean; + + /** + Returns `true` if `filename` doesn't match a junk file. + + @example + ``` + import {promisify} from 'util'; + import * as fs from 'fs'; + import junk = require('junk'); + + const pReaddir = promisify(fs.readdir); + + (async () => { + const files = await pReaddir('some/path'); + + console.log(files); + //=> ['.DS_Store', 'test.jpg'] + + console.log(files.filter(junk.not)); + //=> ['test.jpg'] + })(); + ``` + */ + not(filename: string): boolean; + + /** + Regex used for matching junk files. + */ + readonly regex: RegExp; + + // TODO: Remove this for the next major release + default: typeof junk; +}; + +export = junk; diff --git a/desktop/node_modules/junk/index.js b/desktop/node_modules/junk/index.js new file mode 100644 index 0000000..76efefa --- /dev/null +++ b/desktop/node_modules/junk/index.js @@ -0,0 +1,39 @@ +'use strict'; + +const blacklist = [ + // # All + '^npm-debug\\.log$', // Error log for npm + '^\\..*\\.swp$', // Swap file for vim state + + // # macOS + '^\\.DS_Store$', // Stores custom folder attributes + '^\\.AppleDouble$', // Stores additional file resources + '^\\.LSOverride$', // Contains the absolute path to the app to be used + '^Icon\\r$', // Custom Finder icon: http://superuser.com/questions/298785/icon-file-on-os-x-desktop + '^\\._.*', // Thumbnail + '^\\.Spotlight-V100(?:$|\\/)', // Directory that might appear on external disk + '\\.Trashes', // File that might appear on external disk + '^__MACOSX$', // Resource fork + + // # Linux + '~$', // Backup file + + // # Windows + '^Thumbs\\.db$', // Image file cache + '^ehthumbs\\.db$', // Folder config file + '^Desktop\\.ini$', // Stores custom folder attributes + '@eaDir$' // Synology Diskstation "hidden" folder where the server stores thumbnails +]; + +exports.re = () => { + throw new Error('`junk.re` was renamed to `junk.regex`'); +}; + +exports.regex = new RegExp(blacklist.join('|')); + +exports.is = filename => exports.regex.test(filename); + +exports.not = filename => !exports.is(filename); + +// TODO: Remove this for the next major release +exports.default = module.exports; diff --git a/desktop/node_modules/junk/license b/desktop/node_modules/junk/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/desktop/node_modules/junk/license @@ -0,0 +1,9 @@ +MIT License + +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. diff --git a/desktop/node_modules/junk/package.json b/desktop/node_modules/junk/package.json new file mode 100644 index 0000000..2c940f7 --- /dev/null +++ b/desktop/node_modules/junk/package.json @@ -0,0 +1,42 @@ +{ + "name": "junk", + "version": "3.1.0", + "description": "Filter out system junk files like .DS_Store and Thumbs.db", + "license": "MIT", + "repository": "sindresorhus/junk", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "junk", + "trash", + "garbage", + "files", + "os", + "ignore", + "exclude", + "filter", + "temp", + "tmp", + "system", + "clean", + "cleanup" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/desktop/node_modules/junk/readme.md b/desktop/node_modules/junk/readme.md new file mode 100644 index 0000000..74c23ca --- /dev/null +++ b/desktop/node_modules/junk/readme.md @@ -0,0 +1,51 @@ +# junk [![Build Status](https://travis-ci.org/sindresorhus/junk.svg?branch=master)](https://travis-ci.org/sindresorhus/junk) + +> Filter out [system junk files](test.js) like `.DS_Store` and `Thumbs.db` + + +## Install + +``` +$ npm install junk +``` + + +## Usage + +```js +const {promisify} = require('util'); +const fs = require('fs'); +const junk = require('junk'); + +const pReaddir = promisify(fs.readdir); + +(async () => { + const files = await pReaddir('some/path'); + + console.log(files); + //=> ['.DS_Store', 'test.jpg'] + + console.log(files.filter(junk.not)); + //=> ['test.jpg'] +})(); +``` + + +## API + +### junk.is(filename) + +Returns `true` if `filename` matches a junk file. + +### junk.not(filename) + +Returns `true` if `filename` doesn't match a junk file. + +### junk.regex + +Regex used for matching junk files. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) |