@fullstackunicorn/filesystem 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/modules/fsa.js CHANGED
@@ -42,5 +42,15 @@ export const fsa = {
42
42
  else if (file?.buffer instanceof ArrayBuffer) buffer = Buffer.from(file.buffer)
43
43
  else throw new Error('buffer-error')
44
44
  await fsAsync.writeFile(filePath, buffer)
45
+ },
46
+ isJunk: name => {
47
+ if (!name) return true
48
+ const lower = name.toLowerCase()
49
+ if (lower.endsWith('~') || lower.endsWith('.tmp') || lower.endsWith('.temp')) return true
50
+ return [
51
+ '.ds_store', '._', '.spotlight-v100', '.trashes', '.fseventsd', '.temporaryitems', '.apdisk', '.volumeicon.icns',
52
+ 'thumbs.db', 'ehthumbs.db', 'desktop.ini', '$recycle.bin', 'system volume information',
53
+ 'lost+found', '__macosx', '.swp', '.swo', '.#', '.cache'
54
+ ].some(bad => lower === bad || lower.startsWith(bad))
45
55
  }
46
56
  }
package/modules/fss.js CHANGED
@@ -39,5 +39,15 @@ export const fss = {
39
39
  else if (file?.buffer instanceof ArrayBuffer) buffer = Buffer.from(file.buffer)
40
40
  else throw new Error('buffer-error')
41
41
  fsSync.writeFileSync(filePath, buffer)
42
+ },
43
+ isJunk: name => {
44
+ if (!name) return true
45
+ const lower = name.toLowerCase()
46
+ if (lower.endsWith('~') || lower.endsWith('.tmp') || lower.endsWith('.temp')) return true
47
+ return [
48
+ '.ds_store', '._', '.spotlight-v100', '.trashes', '.fseventsd', '.temporaryitems', '.apdisk', '.volumeicon.icns',
49
+ 'thumbs.db', 'ehthumbs.db', 'desktop.ini', '$recycle.bin', 'system volume information',
50
+ 'lost+found', '__macosx', '.swp', '.swo', '.#', '.cache'
51
+ ].some(bad => lower === bad || lower.startsWith(bad))
42
52
  }
43
53
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.6",
2
+ "version": "1.0.7",
3
3
  "name": "@fullstackunicorn/filesystem",
4
4
  "author": "lucanigido (https://fullstackunicorn.dev/author/lucanigido)",
5
5
  "description": "A simple sync/async file system wrapper for Node.js",