@jscad/io-utils 2.0.30 → 3.0.1-alpha.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.
- package/CHANGELOG.md +6 -211
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/package.json +12 -11
- package/{BinaryReader.js → src/BinaryReader.js} +10 -8
- package/{Blob.js → src/Blob.js} +1 -3
- package/{convertToBlob.js → src/convertToBlob.js} +2 -4
- package/src/ensureString.js +12 -0
- package/src/index.js +12 -0
- package/{makeBlob.js → src/makeBlob.js} +2 -4
- package/src/stringify.js +91 -0
- package/{Blob.test.js → tests/Blob.test.js} +2 -2
- package/{convertToBlob.test.js → tests/convertToBlob.test.js} +2 -2
- package/ensureString.js +0 -9
- package/index.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,419 +3,214 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [3.0.1-alpha.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.22...@jscad/io-utils@3.0.1-alpha.0) (2025-01-03)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [2.0.29](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.28...@jscad/io-utils@2.0.29) (2024-11-10)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @jscad/io-utils
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [2.0.28](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.27...@jscad/io-utils@2.0.28) (2024-10-06)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @jscad/io-utils
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [2.0.27](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.26...@jscad/io-utils@2.0.27) (2024-06-02)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @jscad/io-utils
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [2.0.26](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.25...@jscad/io-utils@2.0.26) (2024-02-18)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @jscad/io-utils
|
|
8
|
+
### Bug Fixes
|
|
41
9
|
|
|
10
|
+
* **io:** fix io after V3 refactoring ([7a12bbd](https://github.com/jscad/OpenJSCAD.org/commit/7a12bbdb7b4b3df792a4c5b3c8b30a6a985a48f0))
|
|
42
11
|
|
|
12
|
+
# [3.0.0-alpha.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.22...@jscad/io-utils@3.0.0-alpha.0) (2023-10-09)
|
|
43
13
|
|
|
14
|
+
### Bug Fixes
|
|
44
15
|
|
|
16
|
+
* **io:** fix io after V3 refactoring ([7a12bbd](https://github.com/jscad/OpenJSCAD.org/commit/7a12bbdb7b4b3df792a4c5b3c8b30a6a985a48f0))
|
|
45
17
|
|
|
46
18
|
## [2.0.25](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.24...@jscad/io-utils@2.0.25) (2023-06-27)
|
|
47
19
|
|
|
48
20
|
**Note:** Version bump only for package @jscad/io-utils
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
22
|
## [2.0.24](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.23...@jscad/io-utils@2.0.24) (2023-04-30)
|
|
55
23
|
|
|
56
24
|
**Note:** Version bump only for package @jscad/io-utils
|
|
57
25
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
26
|
## [2.0.23](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.22...@jscad/io-utils@2.0.23) (2022-11-26)
|
|
63
27
|
|
|
64
28
|
**Note:** Version bump only for package @jscad/io-utils
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
30
|
## [2.0.22](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.21...@jscad/io-utils@2.0.22) (2022-08-21)
|
|
71
31
|
|
|
72
32
|
**Note:** Version bump only for package @jscad/io-utils
|
|
73
33
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
34
|
## [2.0.21](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.20...@jscad/io-utils@2.0.21) (2022-07-17)
|
|
79
35
|
|
|
80
36
|
**Note:** Version bump only for package @jscad/io-utils
|
|
81
37
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
38
|
## [2.0.20](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.19...@jscad/io-utils@2.0.20) (2022-06-12)
|
|
87
39
|
|
|
88
40
|
**Note:** Version bump only for package @jscad/io-utils
|
|
89
41
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
42
|
## [2.0.19](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.18...@jscad/io-utils@2.0.19) (2022-05-15)
|
|
95
43
|
|
|
96
44
|
**Note:** Version bump only for package @jscad/io-utils
|
|
97
45
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
46
|
## [2.0.18](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.17...@jscad/io-utils@2.0.18) (2022-04-24)
|
|
103
47
|
|
|
104
48
|
**Note:** Version bump only for package @jscad/io-utils
|
|
105
49
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
50
|
## [2.0.17](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.16...@jscad/io-utils@2.0.17) (2022-04-03)
|
|
111
51
|
|
|
112
52
|
**Note:** Version bump only for package @jscad/io-utils
|
|
113
53
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
54
|
## [2.0.16](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.15...@jscad/io-utils@2.0.16) (2022-04-03)
|
|
119
55
|
|
|
120
56
|
**Note:** Version bump only for package @jscad/io-utils
|
|
121
57
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
58
|
## [2.0.15](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.14...@jscad/io-utils@2.0.15) (2022-03-13)
|
|
127
59
|
|
|
128
60
|
**Note:** Version bump only for package @jscad/io-utils
|
|
129
61
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
62
|
## [2.0.14](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.13...@jscad/io-utils@2.0.14) (2022-03-06)
|
|
135
63
|
|
|
136
|
-
|
|
137
64
|
### Bug Fixes
|
|
138
65
|
|
|
139
66
|
* **io:** corrected Blob to allocate internal buffer based contents ([#1006](https://github.com/jscad/OpenJSCAD.org/issues/1006)) ([df4552a](https://github.com/jscad/OpenJSCAD.org/commit/df4552a842fd884680d618f6f9b97ac7c7eb9d8b))
|
|
140
67
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
68
|
## [2.0.13](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.12...@jscad/io-utils@2.0.13) (2022-02-19)
|
|
146
69
|
|
|
147
70
|
**Note:** Version bump only for package @jscad/io-utils
|
|
148
71
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
72
|
## [2.0.12](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.11...@jscad/io-utils@2.0.12) (2021-12-26)
|
|
154
73
|
|
|
155
74
|
**Note:** Version bump only for package @jscad/io-utils
|
|
156
75
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
76
|
## [2.0.11](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.10...@jscad/io-utils@2.0.11) (2021-12-11)
|
|
162
77
|
|
|
163
78
|
**Note:** Version bump only for package @jscad/io-utils
|
|
164
79
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
80
|
## [2.0.10](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.9...@jscad/io-utils@2.0.10) (2021-11-07)
|
|
170
81
|
|
|
171
82
|
**Note:** Version bump only for package @jscad/io-utils
|
|
172
83
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
84
|
## [2.0.9](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.8...@jscad/io-utils@2.0.9) (2021-10-17)
|
|
178
85
|
|
|
179
86
|
**Note:** Version bump only for package @jscad/io-utils
|
|
180
87
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
88
|
## [2.0.8](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.7...@jscad/io-utils@2.0.8) (2021-10-04)
|
|
186
89
|
|
|
187
90
|
**Note:** Version bump only for package @jscad/io-utils
|
|
188
91
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
92
|
## [2.0.7](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.6...@jscad/io-utils@2.0.7) (2021-09-27)
|
|
194
93
|
|
|
195
94
|
**Note:** Version bump only for package @jscad/io-utils
|
|
196
95
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
96
|
## [2.0.6](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.5...@jscad/io-utils@2.0.6) (2021-09-09)
|
|
202
97
|
|
|
203
98
|
**Note:** Version bump only for package @jscad/io-utils
|
|
204
99
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
100
|
## [2.0.5](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.4...@jscad/io-utils@2.0.5) (2021-06-20)
|
|
210
101
|
|
|
211
102
|
**Note:** Version bump only for package @jscad/io-utils
|
|
212
103
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
104
|
## [2.0.4](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.3...@jscad/io-utils@2.0.4) (2021-06-11)
|
|
218
105
|
|
|
219
106
|
**Note:** Version bump only for package @jscad/io-utils
|
|
220
107
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
108
|
## [2.0.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.2...@jscad/io-utils@2.0.3) (2021-06-01)
|
|
226
109
|
|
|
227
110
|
**Note:** Version bump only for package @jscad/io-utils
|
|
228
111
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
112
|
## [2.0.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.0...@jscad/io-utils@2.0.2) (2021-04-20)
|
|
234
113
|
|
|
235
|
-
|
|
236
114
|
### Bug Fixes
|
|
237
115
|
|
|
238
116
|
* **all:** V2 : several fixes for modeling ([#705](https://github.com/jscad/OpenJSCAD.org/issues/705)) ([62017a4](https://github.com/jscad/OpenJSCAD.org/commit/62017a41214169d6e000f1e0c11aaefdd68e1097))
|
|
239
117
|
* **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
|
|
240
118
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
119
|
## [2.0.1](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.0...@jscad/io-utils@2.0.1) (2021-04-15)
|
|
246
120
|
|
|
247
|
-
|
|
248
121
|
### Bug Fixes
|
|
249
122
|
|
|
250
123
|
* **all:** V2 : several fixes for modeling ([#705](https://github.com/jscad/OpenJSCAD.org/issues/705)) ([62017a4](https://github.com/jscad/OpenJSCAD.org/commit/62017a41214169d6e000f1e0c11aaefdd68e1097))
|
|
251
124
|
* **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
|
|
252
125
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
126
|
# [2.0.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.11...@jscad/io-utils@2.0.0) (2021-04-12)
|
|
258
127
|
|
|
259
128
|
**Note:** Version bump only for package @jscad/io-utils
|
|
260
129
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
130
|
# [2.0.0-alpha.11](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.10...@jscad/io-utils@2.0.0-alpha.11) (2021-03-07)
|
|
266
131
|
|
|
267
132
|
**Note:** Version bump only for package @jscad/io-utils
|
|
268
133
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
134
|
# [2.0.0-alpha.10](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.9...@jscad/io-utils@2.0.0-alpha.10) (2021-02-07)
|
|
274
135
|
|
|
275
136
|
**Note:** Version bump only for package @jscad/io-utils
|
|
276
137
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
138
|
# [2.0.0-alpha.9](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.8...@jscad/io-utils@2.0.0-alpha.9) (2021-01-02)
|
|
282
139
|
|
|
283
140
|
**Note:** Version bump only for package @jscad/io-utils
|
|
284
141
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
142
|
# [2.0.0-alpha.8](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.7...@jscad/io-utils@2.0.0-alpha.8) (2020-12-04)
|
|
290
143
|
|
|
291
144
|
**Note:** Version bump only for package @jscad/io-utils
|
|
292
145
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
146
|
# [2.0.0-alpha.7](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io-utils@2.0.0-alpha.6...@jscad/io-utils@2.0.0-alpha.7) (2020-11-07)
|
|
298
147
|
|
|
299
|
-
|
|
300
148
|
### Bug Fixes
|
|
301
149
|
|
|
302
150
|
* **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
|
|
303
151
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
152
|
# [2.0.0-alpha.6](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.5...@jscad/io-utils@2.0.0-alpha.6) (2020-10-11)
|
|
309
153
|
|
|
310
|
-
|
|
311
154
|
### Bug Fixes
|
|
312
155
|
|
|
313
156
|
* **all:** V2 : several fixes for modeling ([#705](https://github.com/jscad/io/issues/705)) ([62017a4](https://github.com/jscad/io/commit/62017a41214169d6e000f1e0c11aaefdd68e1097))
|
|
314
157
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
158
|
# [2.0.0-alpha.5](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.4...@jscad/io-utils@2.0.0-alpha.5) (2020-09-29)
|
|
320
159
|
|
|
321
160
|
**Note:** Version bump only for package @jscad/io-utils
|
|
322
161
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
162
|
# [2.0.0-alpha.4](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.3...@jscad/io-utils@2.0.0-alpha.4) (2020-09-28)
|
|
328
163
|
|
|
329
164
|
**Note:** Version bump only for package @jscad/io-utils
|
|
330
165
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
166
|
# [2.0.0-alpha.3](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.2...@jscad/io-utils@2.0.0-alpha.3) (2020-09-19)
|
|
336
167
|
|
|
337
168
|
**Note:** Version bump only for package @jscad/io-utils
|
|
338
169
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
170
|
# [2.0.0-alpha.2](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.1...@jscad/io-utils@2.0.0-alpha.2) (2020-09-08)
|
|
344
171
|
|
|
345
172
|
**Note:** Version bump only for package @jscad/io-utils
|
|
346
173
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
174
|
# [2.0.0-alpha.1](https://github.com/jscad/io/compare/@jscad/io-utils@2.0.0-alpha.0...@jscad/io-utils@2.0.0-alpha.1) (2020-08-19)
|
|
352
175
|
|
|
353
176
|
**Note:** Version bump only for package @jscad/io-utils
|
|
354
177
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
178
|
# 2.0.0-alpha.0 (2020-08-13)
|
|
360
179
|
|
|
361
180
|
### Features
|
|
362
181
|
|
|
363
182
|
* **io:** move most of io code from core/io to io/io-utils
|
|
364
183
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
184
|
<a name="0.1.3"></a>
|
|
370
185
|
## [0.1.3](https://github.com/jscad/io/compare/@jscad/io-utils@0.1.2...@jscad/io-utils@0.1.3) (2018-09-02)
|
|
371
186
|
|
|
372
|
-
|
|
373
187
|
### Bug Fixes
|
|
374
188
|
|
|
375
189
|
* **svg deserializer:** fixed svg-deserializer to work with Inkscape files ([#72](https://github.com/jscad/io/issues/72)) ([f35ea5e](https://github.com/jscad/io/commit/f35ea5e))
|
|
376
190
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
191
|
<a name="0.1.2"></a>
|
|
381
192
|
## [0.1.2](https://github.com/jscad/io/compare/@jscad/io-utils@0.1.1...@jscad/io-utils@0.1.2) (2017-11-04)
|
|
382
193
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
194
|
**Note:** Version bump only for package @jscad/io-utils
|
|
387
195
|
|
|
388
196
|
<a name="0.1.1"></a>
|
|
389
197
|
## [0.1.1](https://github.com/jscad/io/compare/@jscad/io-utils@0.1.0...@jscad/io-utils@0.1.1) (2017-10-30)
|
|
390
198
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
199
|
**Note:** Version bump only for package @jscad/io-utils
|
|
395
200
|
|
|
396
201
|
<a name="0.1.0"></a>
|
|
397
202
|
# [0.1.0](https://github.com/jscad/io/compare/@jscad/io-utils@0.0.4...@jscad/io-utils@0.1.0) (2017-10-15)
|
|
398
203
|
|
|
399
|
-
|
|
400
204
|
### Features
|
|
401
205
|
|
|
402
206
|
* **stl-deserializer:** add ability to deserialize stl to csg ([#32](https://github.com/jscad/io/issues/32)) ([a90dcf4](https://github.com/jscad/io/commit/a90dcf4))
|
|
403
207
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
208
|
<a name="0.0.4"></a>
|
|
408
209
|
## [0.0.4](https://github.com/jscad/io/compare/@jscad/io-utils@0.0.3...@jscad/io-utils@0.0.4) (2017-10-10)
|
|
409
210
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
211
|
**Note:** Version bump only for package @jscad/io-utils
|
|
414
212
|
|
|
415
213
|
<a name="0.0.3"></a>
|
|
416
214
|
## 0.0.3 (2017-10-10)
|
|
417
215
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
216
|
**Note:** Version bump only for package @jscad/io-utils
|
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
The MIT License (MIT)
|
|
3
3
|
|
|
4
|
-
Copyright (c) 2017-
|
|
4
|
+
Copyright (c) 2017-2025 JSCAD Organization
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://github.com/jscad/OpenJSCAD.org/blob/master/LICENSE)
|
|
10
10
|
|
|
11
11
|
[](https://openjscad.nodebb.com/)
|
|
12
|
-
[](https://github.com/ghiscoding/lerna-lite)
|
|
13
13
|
[](https://standardjs.com)
|
|
14
14
|
|
|
15
15
|
[](https://opencollective.com/openjscad)
|
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jscad/io-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1-alpha.0",
|
|
4
4
|
"description": "Utilities for JSCAD IO Packages",
|
|
5
5
|
"homepage": "https://openjscad.xyz/",
|
|
6
6
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "src/index.js",
|
|
8
9
|
"scripts": {
|
|
9
|
-
"coverage": "
|
|
10
|
-
"test": "ava '
|
|
10
|
+
"coverage": "c8 --all --reporter=html --reporter=text npm test",
|
|
11
|
+
"test": "ava './tests/*.test.js' --verbose --timeout 2m"
|
|
11
12
|
},
|
|
12
13
|
"contributors": [
|
|
13
14
|
{
|
|
14
15
|
"name": "Rene K. Mueller",
|
|
15
|
-
"url": "
|
|
16
|
+
"url": "https://github.com/Spiritdude"
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
"name": "z3dev",
|
|
19
|
-
"url": "
|
|
20
|
+
"url": "https://github.com/z3dev"
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
"name": "Mark 'kaosat-dev' Moissette",
|
|
23
|
-
"url": "
|
|
24
|
+
"url": "https://github.com/kaosat-dev"
|
|
24
25
|
}
|
|
25
26
|
],
|
|
26
27
|
"keywords": [
|
|
@@ -33,9 +34,9 @@
|
|
|
33
34
|
],
|
|
34
35
|
"license": "MIT",
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@jscad/modeling": "
|
|
37
|
-
"ava": "3.
|
|
38
|
-
"
|
|
37
|
+
"@jscad/modeling": "3.0.1-alpha.0",
|
|
38
|
+
"ava": "^4.3.3",
|
|
39
|
+
"c8": "^8.0.0"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0660b5c1f1a5faf54d4cfae1cb85bb94182a8d32"
|
|
41
42
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// + Jonas Raoni Soares Silva
|
|
8
8
|
// @ http://jsfromhell.com/classes/binary-deserializer [rev. #1]
|
|
9
9
|
|
|
10
|
-
class BinaryReader {
|
|
10
|
+
export class BinaryReader {
|
|
11
11
|
/*
|
|
12
12
|
* Construct a BinaryReader from the given data.
|
|
13
13
|
* The data is a string created from the specified sequence of UTF-16 code units.
|
|
@@ -62,7 +62,7 @@ class BinaryReader {
|
|
|
62
62
|
const exponent = this._readBits(precisionBits, exponentBits, size)
|
|
63
63
|
let significand = 0
|
|
64
64
|
let divisor = 2
|
|
65
|
-
let curByte = 0 // length + (-precisionBits >> 3) - 1
|
|
65
|
+
let curByte = 0 // length + (-precisionBits >> 3) - 1
|
|
66
66
|
let startBit = 0
|
|
67
67
|
do {
|
|
68
68
|
const byteValue = this._readByte(++curByte, size)
|
|
@@ -78,9 +78,13 @@ class BinaryReader {
|
|
|
78
78
|
|
|
79
79
|
this._pos += size
|
|
80
80
|
|
|
81
|
-
return exponent === (bias << 1) + 1
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
return exponent === (bias << 1) + 1
|
|
82
|
+
? significand ? NaN : signal ? -Infinity : +Infinity
|
|
83
|
+
: (1 + signal * -2) * (exponent || significand
|
|
84
|
+
? !exponent
|
|
85
|
+
? Math.pow(2, -bias + 1) * significand
|
|
86
|
+
: Math.pow(2, exponent - bias) * (1 + significand)
|
|
87
|
+
: 0)
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
_decodeInt (bits, signed) {
|
|
@@ -124,9 +128,7 @@ class BinaryReader {
|
|
|
124
128
|
|
|
125
129
|
_checkSize (neededBits) {
|
|
126
130
|
if (!(this._pos + Math.ceil(neededBits / 8) < this._buffer.length)) {
|
|
127
|
-
// throw new Error("Index out of bound")
|
|
131
|
+
// throw new Error("Index out of bound")
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
|
|
132
|
-
module.exports = BinaryReader
|
package/{Blob.js → src/Blob.js}
RENAMED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data.
|
|
21
21
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Blob
|
|
22
22
|
*/
|
|
23
|
-
class Blob {
|
|
23
|
+
export class Blob {
|
|
24
24
|
/**
|
|
25
25
|
* Returns a newly created Blob object which contains a concatenation of all of the data in the given contents.
|
|
26
26
|
* @param {Array} contents - an array of ArrayBuffer, or String objects that will be put inside the Blob.
|
|
@@ -136,5 +136,3 @@ class Blob {
|
|
|
136
136
|
return ''
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
module.exports = Blob
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { makeBlob } from './makeBlob.js'
|
|
2
2
|
|
|
3
3
|
const Blob = makeBlob()
|
|
4
4
|
|
|
@@ -13,10 +13,8 @@ const Blob = makeBlob()
|
|
|
13
13
|
* const blob1 = convertToBlob({ data: ['test'], mimeType: 'text/plain' })
|
|
14
14
|
* const blob2 = convertToBlob({ data: [Int32Array.from('12345').buffer], mimeType: 'application/mine' })
|
|
15
15
|
*/
|
|
16
|
-
const convertToBlob = (input) => {
|
|
16
|
+
export const convertToBlob = (input) => {
|
|
17
17
|
const { data, mimeType } = input
|
|
18
18
|
const blob = new Blob(data, { type: mimeType })
|
|
19
19
|
return blob
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
module.exports = convertToBlob
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure the give buffer is a string, or decode the buffer contents into a string.
|
|
3
|
+
* @return {string} contents of the given buffer as a string
|
|
4
|
+
* @alias module:io/utils.ensureString
|
|
5
|
+
*/
|
|
6
|
+
export const ensureString = (stringOrArrayBuffer, defaultBinaryEncoding = 'utf-8') => {
|
|
7
|
+
if (typeof (stringOrArrayBuffer) === 'string') {
|
|
8
|
+
return stringOrArrayBuffer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return new TextDecoder(defaultBinaryEncoding).decode(new Uint8Array(stringOrArrayBuffer));
|
|
12
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions of various sorts in support of IO packages.
|
|
3
|
+
* @module io/utils
|
|
4
|
+
* @example
|
|
5
|
+
* const { BinaryReader } = require('@jscad/io-utils')
|
|
6
|
+
*/
|
|
7
|
+
export { convertToBlob } from './convertToBlob.js'
|
|
8
|
+
export { makeBlob } from './makeBlob.js'
|
|
9
|
+
export { BinaryReader } from './BinaryReader.js'
|
|
10
|
+
export { Blob } from './Blob.js'
|
|
11
|
+
export { stringify } from './stringify.js'
|
|
12
|
+
export { ensureString } from './ensureString.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { Blob as nodeBlob } from './Blob.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Make a constructor for Blob objects.
|
|
@@ -8,9 +8,7 @@ const nodeBlob = require('./Blob.js')
|
|
|
8
8
|
* const Blob = makeBlob()
|
|
9
9
|
* const ablob = new Blob(data, { type: mimeType })
|
|
10
10
|
*/
|
|
11
|
-
const makeBlob = () => {
|
|
11
|
+
export const makeBlob = () => {
|
|
12
12
|
const blob = typeof window !== 'undefined' ? window.Blob : nodeBlob
|
|
13
13
|
return blob
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
module.exports = makeBlob
|
package/src/stringify.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Originally from OMNL library by @drom
|
|
3
|
+
* License MIT
|
|
4
|
+
*/
|
|
5
|
+
const isObject = (o) => o && Object.prototype.toString.call(o) === '[object Object]'
|
|
6
|
+
|
|
7
|
+
const indenter = (indentation) => {
|
|
8
|
+
if (!(indentation > 0)) {
|
|
9
|
+
return (txt) => txt
|
|
10
|
+
}
|
|
11
|
+
const space = ' '.repeat(indentation)
|
|
12
|
+
return (txt) => {
|
|
13
|
+
if (typeof txt !== 'string') {
|
|
14
|
+
return txt
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const arr = txt.split('\n')
|
|
18
|
+
|
|
19
|
+
if (arr.length === 1) {
|
|
20
|
+
return space + txt
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return arr
|
|
24
|
+
.map((e) => (e.trim() === '') ? e : space + e)
|
|
25
|
+
.join('\n')
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const clean = (txt) => txt
|
|
30
|
+
.split('\n')
|
|
31
|
+
.filter((e) => e.trim() !== '')
|
|
32
|
+
.join('\n')
|
|
33
|
+
|
|
34
|
+
export const stringify = (a, indentation) => {
|
|
35
|
+
const cr = (indentation > 0) ? '\n' : ''
|
|
36
|
+
const indent = indenter(indentation)
|
|
37
|
+
|
|
38
|
+
const rec = (a) => {
|
|
39
|
+
let body = ''
|
|
40
|
+
let isFlat = true
|
|
41
|
+
|
|
42
|
+
let res
|
|
43
|
+
const isEmpty = a.some((e, i, arr) => {
|
|
44
|
+
if (i === 0) {
|
|
45
|
+
res = '<' + e
|
|
46
|
+
return (arr.length === 1)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (i === 1) {
|
|
50
|
+
if (isObject(e)) {
|
|
51
|
+
Object.keys(e).forEach((key) => {
|
|
52
|
+
let val = e[key]
|
|
53
|
+
if (Array.isArray(val)) {
|
|
54
|
+
val = val.join(' ')
|
|
55
|
+
}
|
|
56
|
+
res += ' ' + key + '="' + val + '"'
|
|
57
|
+
})
|
|
58
|
+
if (arr.length === 2) {
|
|
59
|
+
return true
|
|
60
|
+
}
|
|
61
|
+
res += '>'
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
res += '>'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
switch (typeof e) {
|
|
68
|
+
case 'string':
|
|
69
|
+
case 'number':
|
|
70
|
+
case 'boolean':
|
|
71
|
+
case 'undefined':
|
|
72
|
+
body += e + cr
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
isFlat = false
|
|
77
|
+
body += rec(e)
|
|
78
|
+
return false
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
if (isEmpty) {
|
|
82
|
+
return res + '/>' + cr // short form
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return isFlat
|
|
86
|
+
? res + clean(body) + '</' + a[0] + '>' + cr
|
|
87
|
+
: res + cr + indent(body) + '</' + a[0] + '>' + cr
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return rec(a)
|
|
91
|
+
}
|
package/ensureString.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const ensureString = (stringOrArrayBuffer, defaultBinaryEncoding = 'utf-8') => {
|
|
2
|
-
if (typeof (stringOrArrayBuffer) === 'string') {
|
|
3
|
-
return stringOrArrayBuffer
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
return new TextDecoder(defaultBinaryEncoding).decode(new Uint8Array(stringOrArrayBuffer))
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
module.exports = ensureString
|
package/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions of various sorts in support of IO packages.
|
|
3
|
-
* @module io/utils
|
|
4
|
-
* @example
|
|
5
|
-
* const { BinaryReader } = require('@jscad/io-utils')
|
|
6
|
-
*/
|
|
7
|
-
module.exports = {
|
|
8
|
-
convertToBlob: require('./convertToBlob'),
|
|
9
|
-
makeBlob: require('./makeBlob'),
|
|
10
|
-
BinaryReader: require('./BinaryReader'),
|
|
11
|
-
Blob: require('./Blob'),
|
|
12
|
-
ensureString: require('./ensureString')
|
|
13
|
-
}
|