| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | 'use strict'; |
| 2 | |
| 3 | const blacklist = [ |
| 4 | // # All |
| 5 | '^npm-debug\\.log$', // Error log for npm |
| 6 | '^\\..*\\.swp$', // Swap file for vim state |
| 7 | |
| 8 | // # macOS |
| 9 | '^\\.DS_Store$', // Stores custom folder attributes |
| 10 | '^\\.AppleDouble$', // Stores additional file resources |
| 11 | '^\\.LSOverride$', // Contains the absolute path to the app to be used |
| 12 | '^Icon\\r$', // Custom Finder icon: http://superuser.com/questions/298785/icon-file-on-os-x-desktop |
| 13 | '^\\._.*', // Thumbnail |
| 14 | '^\\.Spotlight-V100(?:$|\\/)', // Directory that might appear on external disk |
| 15 | '\\.Trashes', // File that might appear on external disk |
| 16 | '^__MACOSX$', // Resource fork |
| 17 | |
| 18 | // # Linux |
| 19 | '~$', // Backup file |
| 20 | |
| 21 | // # Windows |
| 22 | '^Thumbs\\.db$', // Image file cache |
| 23 | '^ehthumbs\\.db$', // Folder config file |
| 24 | '^Desktop\\.ini$', // Stores custom folder attributes |
| 25 | '@eaDir$' // Synology Diskstation "hidden" folder where the server stores thumbnails |
| 26 | ]; |
| 27 | |
| 28 | exports.re = () => { |
| 29 | throw new Error('`junk.re` was renamed to `junk.regex`'); |
| 30 | }; |
| 31 | |
| 32 | exports.regex = new RegExp(blacklist.join('|')); |
| 33 | |
| 34 | exports.is = filename => exports.regex.test(filename); |
| 35 | |
| 36 | exports.not = filename => !exports.is(filename); |
| 37 | |
| 38 | // TODO: Remove this for the next major release |
| 39 | exports.default = module.exports; |