@bemoje/fs 1.1.2 → 2.0.0

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.
Files changed (2) hide show
  1. package/README.md +20 -19
  2. package/package.json +16 -126
package/README.md CHANGED
@@ -2,8 +2,26 @@
2
2
 
3
3
  File system utilities for reading, updating, and managing files and directories.
4
4
 
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
6
- [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/) [![Module](https://img.shields.io/badge/Module-ESM-yellow)](https://nodejs.org/api/esm.html)
6
+
7
+ ## Exports
8
+
9
+ <!-- EXPORTS_START -->
10
+
11
+ - **deleteOlderThan**: Delete files older than a given timestamp
12
+ - **getFileAge**: Retrieves the age of a file in milliseconds.
13
+ - **getFirstFileInDir** found in a directory.
14
+ - **readFileFirstLine**: Reads the first line of a file asynchronously.
15
+ - **removeDataUrlSchemePrefix**: Removes the data URL scheme prefix from a given string.
16
+ - **updateFile**: Updates a file by reading its content, applying a transformation function, and writing back the result. Creates the file and directories if they don't exist.
17
+ - **updateFileLines** or an array of lines. Creates the file and directories if they don't exist.
18
+ - **updateFileLinesSync**: Synchronous version of `updateFileLines`.
19
+ - **updateFileSync**: Synchronous version of `updateFile`.
20
+ - **updateJsonFile**: Updates a JSON file by applying a transformation function to the parsed content. If the file doesn't exist or can't be parsed, uses the default value. Creates the file and directories if they don't exist.
21
+ - **updateJsonFileSync**: Synchronous version of `updateJsonFile`.
22
+ - **walkDirectory**: Walk a directory recursively and return an array of paths.
23
+
24
+ <!-- EXPORTS_END -->
7
25
 
8
26
  ## Installation
9
27
 
@@ -111,20 +129,3 @@ import { removeDataUrlSchemePrefix } from '@bemoje/fs'
111
129
  removeDataUrlSchemePrefix('data:image/png;base64,iVBOR...')
112
130
  // 'iVBOR...'
113
131
  ```
114
-
115
- ## API Reference
116
-
117
- | Export | Description |
118
- | --------------------------- | ----------------------------------------------------- |
119
- | `walkDirectory` | Recursively walk a directory with filtering and stats |
120
- | `updateFile` | Async read-transform-write a file |
121
- | `updateFileSync` | Sync read-transform-write a file |
122
- | `updateFileLines` | Async read-transform-write a file by lines |
123
- | `updateFileLinesSync` | Sync read-transform-write a file by lines |
124
- | `updateJsonFile` | Async read-transform-write a JSON file |
125
- | `updateJsonFileSync` | Sync read-transform-write a JSON file |
126
- | `deleteOlderThan` | Delete files older than a given age |
127
- | `getFileAge` | Get file age in milliseconds |
128
- | `getFirstFileInDir` | Get the first file name in a directory |
129
- | `readFileFirstLine` | Read only the first line of a file |
130
- | `removeDataUrlSchemePrefix` | Strip data URL scheme prefix from a string |
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@bemoje/fs",
3
- "version": "1.1.2",
3
+ "version": "2.0.0",
4
4
  "description": "File system utilities for reading, updating, and managing files and directories.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "dependencies": {
11
+ "fs-extra": "^11.3.4",
12
+ "upath": "^2.0.1",
13
+ "walkdir": "^0.4.1",
14
+ "@types/fs-extra": "^11.0.4"
15
+ },
7
16
  "keywords": [
8
17
  "fs",
9
18
  "file-system",
@@ -35,117 +44,7 @@
35
44
  "default": "./lib/index.cjs"
36
45
  }
37
46
  },
38
- "./deleteOlderThan": {
39
- "import": {
40
- "types": "./lib/index.d.ts",
41
- "default": "./lib/index.js"
42
- },
43
- "require": {
44
- "types": "./lib/index.d.cts",
45
- "default": "./lib/index.cjs"
46
- }
47
- },
48
- "./getFileAge": {
49
- "import": {
50
- "types": "./lib/index.d.ts",
51
- "default": "./lib/index.js"
52
- },
53
- "require": {
54
- "types": "./lib/index.d.cts",
55
- "default": "./lib/index.cjs"
56
- }
57
- },
58
- "./getFirstFileInDir": {
59
- "import": {
60
- "types": "./lib/index.d.ts",
61
- "default": "./lib/index.js"
62
- },
63
- "require": {
64
- "types": "./lib/index.d.cts",
65
- "default": "./lib/index.cjs"
66
- }
67
- },
68
- "./readFileFirstLine": {
69
- "import": {
70
- "types": "./lib/index.d.ts",
71
- "default": "./lib/index.js"
72
- },
73
- "require": {
74
- "types": "./lib/index.d.cts",
75
- "default": "./lib/index.cjs"
76
- }
77
- },
78
- "./removeDataUrlSchemePrefix": {
79
- "import": {
80
- "types": "./lib/index.d.ts",
81
- "default": "./lib/index.js"
82
- },
83
- "require": {
84
- "types": "./lib/index.d.cts",
85
- "default": "./lib/index.cjs"
86
- }
87
- },
88
- "./updateFile": {
89
- "import": {
90
- "types": "./lib/index.d.ts",
91
- "default": "./lib/index.js"
92
- },
93
- "require": {
94
- "types": "./lib/index.d.cts",
95
- "default": "./lib/index.cjs"
96
- }
97
- },
98
- "./updateFileLines": {
99
- "import": {
100
- "types": "./lib/index.d.ts",
101
- "default": "./lib/index.js"
102
- },
103
- "require": {
104
- "types": "./lib/index.d.cts",
105
- "default": "./lib/index.cjs"
106
- }
107
- },
108
- "./updateFileLinesSync": {
109
- "import": {
110
- "types": "./lib/index.d.ts",
111
- "default": "./lib/index.js"
112
- },
113
- "require": {
114
- "types": "./lib/index.d.cts",
115
- "default": "./lib/index.cjs"
116
- }
117
- },
118
- "./updateFileSync": {
119
- "import": {
120
- "types": "./lib/index.d.ts",
121
- "default": "./lib/index.js"
122
- },
123
- "require": {
124
- "types": "./lib/index.d.cts",
125
- "default": "./lib/index.cjs"
126
- }
127
- },
128
- "./updateJsonFile": {
129
- "import": {
130
- "types": "./lib/index.d.ts",
131
- "default": "./lib/index.js"
132
- },
133
- "require": {
134
- "types": "./lib/index.d.cts",
135
- "default": "./lib/index.cjs"
136
- }
137
- },
138
- "./updateJsonFileSync": {
139
- "import": {
140
- "types": "./lib/index.d.ts",
141
- "default": "./lib/index.js"
142
- },
143
- "require": {
144
- "types": "./lib/index.d.cts",
145
- "default": "./lib/index.cjs"
146
- }
147
- },
148
- "./walkDirectory": {
47
+ "./*": {
149
48
  "import": {
150
49
  "types": "./lib/index.d.ts",
151
50
  "default": "./lib/index.js"
@@ -156,24 +55,15 @@
156
55
  }
157
56
  }
158
57
  },
159
- "dependencies": {
160
- "fs-extra": "^11.3.4",
161
- "upath": "^2.0.1",
162
- "walkdir": "^0.4.1",
163
- "@types/fs-extra": "^11.0.4"
164
- },
165
- "publishConfig": {
166
- "access": "public"
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/bemoje/mono.git",
61
+ "directory": "libs/fs"
167
62
  },
168
- "license": "MIT",
169
63
  "author": {
170
64
  "name": "Benjamin Møller Jensen",
171
65
  "email": "bemoje@bemoje.net",
172
66
  "url": "https://github.com/bemoje/"
173
67
  },
174
- "repository": {
175
- "type": "git",
176
- "url": "git+https://github.com/bemoje/mono.git",
177
- "directory": "libs/fs"
178
- }
68
+ "license": "MIT"
179
69
  }