utilitas 1995.2.78 → 1995.2.80

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/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.78",
4
+ "version": "1995.2.80",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/storage.mjs CHANGED
@@ -21,6 +21,7 @@ const getIdByGs = gs => gs.replace(/^gs:\/\/[^/]*\/(.*)$/, '$1');
21
21
  const mapFilename = name => join(name.substr(0, 2), name.substr(2, 2));
22
22
  const [_zip, _unzip] = [__zip, __unzip].map(promisify);
23
23
  const log = content => _log(content, import.meta.url);
24
+ const sanitizeFilename = (s, r) => s.replace(/[\/?<>\\:*|"]/g, r || '_').trim();
24
25
 
25
26
  const [
26
27
  NULL, BASE64, BUFFER, FILE, STREAM, TEXT, _JSON, encoding, BINARY, mode,
@@ -36,7 +37,7 @@ const [encodeBase64, encodeBinary, encodeNull]
36
37
  let [client, bucket, url] = [null, null, null];
37
38
 
38
39
  const readFile = async (name, options) => await fs.readFile(
39
- name, ['NULL', 'BUFFER'].includes(
40
+ name, [NULL, BUFFER].includes(
40
41
  ensureString(options?.encoding, { case: 'UP' })
41
42
  ) ? null : (options?.encoding || encoding)
42
43
  );
@@ -451,6 +452,7 @@ export {
451
452
  mergeFile,
452
453
  readFile,
453
454
  readJson,
455
+ sanitizeFilename,
454
456
  setConfig,
455
457
  sliceFile,
456
458
  touchPath,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.78",
4
+ "version": "1995.2.80",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",