@d0paminedriven/fs 6.3.0 → 6.5.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/README.md +67 -0
- package/dist/{chunk-C6AZRX7V.js → chunk-O4BKLMFV.js} +2 -2
- package/dist/{chunk-XHN56MDK.js → chunk-QBG7TFHM.js} +5 -2
- package/dist/{chunk-NGBMZGGU.js → chunk-Y3TLKN7F.js} +61 -5
- package/dist/fs/index.cjs +188 -4
- package/dist/fs/index.d.cts +49 -6
- package/dist/fs/index.d.ts +49 -6
- package/dist/fs/index.js +4 -3
- package/dist/index.cjs +185 -129
- package/dist/index.js +3 -3
- package/dist/mime/index.cjs +129 -1
- package/dist/mime/index.d.cts +4 -3
- package/dist/mime/index.d.ts +4 -3
- package/dist/mime/index.js +3 -2
- package/dist/url/index.cjs +131 -1
- package/dist/url/index.d.cts +6 -1
- package/dist/url/index.d.ts +6 -1
- package/dist/url/index.js +2 -1
- package/package.json +3 -3
package/dist/mime/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { XOR } from '../types/index.cjs';
|
|
|
2
2
|
import { UrlService } from '../url/index.cjs';
|
|
3
3
|
import 'stream';
|
|
4
4
|
import 'buffer';
|
|
5
|
+
import '../utils/index.cjs';
|
|
5
6
|
|
|
6
7
|
declare const extMimeMap: {
|
|
7
8
|
readonly aac: readonly ["audio/aac"];
|
|
@@ -456,15 +457,15 @@ declare class MimeService extends UrlService {
|
|
|
456
457
|
compareMimeToExt(p?: "mime" | "ext"): {
|
|
457
458
|
[k: string]: number;
|
|
458
459
|
};
|
|
459
|
-
assetType<const T extends string>(url: T): "
|
|
460
|
+
assetType<const T extends string>(url: T): "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avif" | "avi" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jpeg" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpeg" | "mpkg" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "png" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
|
|
460
461
|
getMimes<const E extends FileExtension>(ext: E): readonly ["audio/aac"] | readonly ["application/x-abiword"] | readonly ["image/aces"] | readonly ["image/apng"] | readonly ["application/x-freearc"] | readonly ["image/avci"] | readonly ["image/avif"] | readonly ["video/x-msvideo"] | readonly ["application/vnd.amazon.ebook"] | readonly ["application/octet-stream", "multipart/voice-message"] | readonly ["image/bmp"] | readonly ["application/x-bzip"] | readonly ["application/x-bzip2"] | readonly ["application/x-cdf"] | readonly ["application/node", "text/javascript"] | readonly ["application/x-csh"] | readonly ["text/css"] | readonly ["text/csv"] | readonly ["application/msword"] | readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] | readonly ["image/dpx"] | readonly ["image/emf"] | readonly ["application/vnd.ms-fontobject"] | readonly ["application/epub+zip"] | readonly ["image/gif"] | readonly ["model/gltf-binary"] | readonly ["model/gltf+json"] | readonly ["application/gzip", "application/x-gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon"] | readonly ["text/calendar"] | readonly ["haptics/ivs"] | readonly ["application/java-archive"] | readonly ["image/jpeg"] | readonly ["application/json"] | readonly ["application/ld+json"] | readonly ["image/ktx"] | readonly ["image/ktx2"] | readonly ["application/vnd.apple.mpegurl"] | readonly ["audio/mp4"] | readonly ["video/mp4"] | readonly ["text/markdown"] | readonly ["application/x-mdx"] | readonly ["audio/midi"] | readonly ["audio/x-midi"] | readonly ["text/javascript"] | readonly ["audio/mpeg"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/x-ndjson"] | readonly ["model/obj", "application/octet-stream", "text/plain"] | readonly ["application/vnd.oasis.opendocument.presentation"] | readonly ["application/vnd.oasis.opendocument.spreadsheet"] | readonly ["application/vnd.oasis.opendocument.text"] | readonly ["audio/ogg"] | readonly ["video/ogg"] | readonly ["application/ogg"] | readonly ["font/otf"] | readonly ["image/png"] | readonly ["application/pdf"] | readonly ["application/x-httpd-php"] | readonly ["application/vnd.apple.pkpass"] | readonly ["application/vnd.ms-powerpoint"] | readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] | readonly ["text/x-python"] | readonly ["application/x-python-code"] | readonly ["application/vnd.rar"] | readonly ["text/rust"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["text/event-stream"] | readonly ["image/svg+xml"] | readonly ["application/x-tar"] | readonly ["image/tiff"] | readonly ["application/toml"] | readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"] | readonly ["application/font-sfnt", "font/ttf"] | readonly ["text/plain"] | readonly ["model/vnd.usdz+zip"] | readonly ["application/vnd.visio"] | readonly ["text/vtt"] | readonly ["application/wasm"] | readonly ["audio/wav"] | readonly ["video/webm"] | readonly ["image/webp"] | readonly ["font/woff"] | readonly ["font/woff2"] | readonly ["application/xhtml+xml"] | readonly ["application/vnd.ms-excel"] | readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] | readonly ["application/xml"] | readonly ["application/vnd.mozilla.xul+xml"] | readonly ["application/yaml"] | readonly ["application/zip", "application/x-zip-compressed"] | readonly ["video/3gpp"] | readonly ["video/3gpp2"] | readonly ["application/x-7z-compressed"];
|
|
461
462
|
getMimeFor<const E extends FileExtension>(ext: E, opts?: {
|
|
462
463
|
type?: MimeTopLevelType;
|
|
463
464
|
}): FileExtensionToMimeType<E>;
|
|
464
|
-
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "
|
|
465
|
+
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
|
|
465
466
|
getMimeTypeForPath<T extends string>(path: T, opts?: {
|
|
466
467
|
type?: MimeTopLevelType;
|
|
467
|
-
}): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "
|
|
468
|
+
}): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
|
|
468
469
|
}
|
|
469
470
|
|
|
470
471
|
export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type MimeType, type MimeTypeToFileExtension, type PresentMimeTopLevelTypes, extMimeMap, mimeToExt };
|
package/dist/mime/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { XOR } from '../types/index.js';
|
|
|
2
2
|
import { UrlService } from '../url/index.js';
|
|
3
3
|
import 'stream';
|
|
4
4
|
import 'buffer';
|
|
5
|
+
import '../utils/index.js';
|
|
5
6
|
|
|
6
7
|
declare const extMimeMap: {
|
|
7
8
|
readonly aac: readonly ["audio/aac"];
|
|
@@ -456,15 +457,15 @@ declare class MimeService extends UrlService {
|
|
|
456
457
|
compareMimeToExt(p?: "mime" | "ext"): {
|
|
457
458
|
[k: string]: number;
|
|
458
459
|
};
|
|
459
|
-
assetType<const T extends string>(url: T): "
|
|
460
|
+
assetType<const T extends string>(url: T): "aac" | "abw" | "aces" | "apng" | "arc" | "avci" | "avif" | "avi" | "azw" | "bin" | "bmp" | "bz" | "bz2" | "cda" | "cjs" | "csh" | "css" | "csv" | "doc" | "docx" | "dpx" | "emf" | "eot" | "epub" | "gif" | "glb" | "gltf" | "gz" | "hjif" | "hmpg" | "htm" | "html" | "ico" | "ics" | "ivs" | "ivt" | "jar" | "jpeg" | "jpg" | "js" | "json" | "jsonld" | "ktx" | "ktx2" | "m3u8" | "m4a" | "m4v" | "md" | "mdx" | "mid" | "midi" | "mjs" | "mp3" | "mp4" | "mpeg" | "mpkg" | "ndjson" | "node" | "obj" | "odp" | "ods" | "odt" | "oga" | "ogg" | "ogv" | "ogx" | "opus" | "otf" | "png" | "pdf" | "php" | "pkpass" | "ppt" | "pptx" | "py" | "pyc" | "rar" | "rs" | "rtf" | "sh" | "sql" | "sse" | "svg" | "tar" | "tif" | "tiff" | "toml" | "ts" | "ttf" | "txt" | "usdz" | "vsd" | "vtt" | "wasm" | "wav" | "weba" | "webp" | "woff" | "woff2" | "xhtml" | "xls" | "xlsx" | "xml" | "xul" | "yaml" | "yml" | "zip" | "3gp" | "3g2" | "7z" | undefined;
|
|
460
461
|
getMimes<const E extends FileExtension>(ext: E): readonly ["audio/aac"] | readonly ["application/x-abiword"] | readonly ["image/aces"] | readonly ["image/apng"] | readonly ["application/x-freearc"] | readonly ["image/avci"] | readonly ["image/avif"] | readonly ["video/x-msvideo"] | readonly ["application/vnd.amazon.ebook"] | readonly ["application/octet-stream", "multipart/voice-message"] | readonly ["image/bmp"] | readonly ["application/x-bzip"] | readonly ["application/x-bzip2"] | readonly ["application/x-cdf"] | readonly ["application/node", "text/javascript"] | readonly ["application/x-csh"] | readonly ["text/css"] | readonly ["text/csv"] | readonly ["application/msword"] | readonly ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] | readonly ["image/dpx"] | readonly ["image/emf"] | readonly ["application/vnd.ms-fontobject"] | readonly ["application/epub+zip"] | readonly ["image/gif"] | readonly ["model/gltf-binary"] | readonly ["model/gltf+json"] | readonly ["application/gzip", "application/x-gzip"] | readonly ["haptics/hjif"] | readonly ["haptics/hmpg"] | readonly ["text/html"] | readonly ["image/vnd.microsoft.icon"] | readonly ["text/calendar"] | readonly ["haptics/ivs"] | readonly ["application/java-archive"] | readonly ["image/jpeg"] | readonly ["application/json"] | readonly ["application/ld+json"] | readonly ["image/ktx"] | readonly ["image/ktx2"] | readonly ["application/vnd.apple.mpegurl"] | readonly ["audio/mp4"] | readonly ["video/mp4"] | readonly ["text/markdown"] | readonly ["application/x-mdx"] | readonly ["audio/midi"] | readonly ["audio/x-midi"] | readonly ["text/javascript"] | readonly ["audio/mpeg"] | readonly ["video/mpeg"] | readonly ["application/vnd.apple.installer+xml"] | readonly ["application/x-ndjson"] | readonly ["model/obj", "application/octet-stream", "text/plain"] | readonly ["application/vnd.oasis.opendocument.presentation"] | readonly ["application/vnd.oasis.opendocument.spreadsheet"] | readonly ["application/vnd.oasis.opendocument.text"] | readonly ["audio/ogg"] | readonly ["video/ogg"] | readonly ["application/ogg"] | readonly ["font/otf"] | readonly ["image/png"] | readonly ["application/pdf"] | readonly ["application/x-httpd-php"] | readonly ["application/vnd.apple.pkpass"] | readonly ["application/vnd.ms-powerpoint"] | readonly ["application/vnd.openxmlformats-officedocument.presentationml.presentation"] | readonly ["text/x-python"] | readonly ["application/x-python-code"] | readonly ["application/vnd.rar"] | readonly ["text/rust"] | readonly ["application/rtf"] | readonly ["application/x-sh"] | readonly ["application/sql"] | readonly ["text/event-stream"] | readonly ["image/svg+xml"] | readonly ["application/x-tar"] | readonly ["image/tiff"] | readonly ["application/toml"] | readonly ["text/typescript", "video/mp2t", "video/vnd.dlna.mpeg-tts"] | readonly ["application/font-sfnt", "font/ttf"] | readonly ["text/plain"] | readonly ["model/vnd.usdz+zip"] | readonly ["application/vnd.visio"] | readonly ["text/vtt"] | readonly ["application/wasm"] | readonly ["audio/wav"] | readonly ["video/webm"] | readonly ["image/webp"] | readonly ["font/woff"] | readonly ["font/woff2"] | readonly ["application/xhtml+xml"] | readonly ["application/vnd.ms-excel"] | readonly ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] | readonly ["application/xml"] | readonly ["application/vnd.mozilla.xul+xml"] | readonly ["application/yaml"] | readonly ["application/zip", "application/x-zip-compressed"] | readonly ["video/3gpp"] | readonly ["video/3gpp2"] | readonly ["application/x-7z-compressed"];
|
|
461
462
|
getMimeFor<const E extends FileExtension>(ext: E, opts?: {
|
|
462
463
|
type?: MimeTopLevelType;
|
|
463
464
|
}): FileExtensionToMimeType<E>;
|
|
464
|
-
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "
|
|
465
|
+
isMimeFor<const E extends FileExtension>(ext: E, mime: FileExtensionToMimeType<E>): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed" | undefined;
|
|
465
466
|
getMimeTypeForPath<T extends string>(path: T, opts?: {
|
|
466
467
|
type?: MimeTopLevelType;
|
|
467
|
-
}): "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "
|
|
468
|
+
}): "application/octet-stream" | "audio/aac" | "application/x-abiword" | "image/aces" | "image/apng" | "application/x-freearc" | "image/avci" | "image/avif" | "video/x-msvideo" | "application/vnd.amazon.ebook" | "multipart/voice-message" | "image/bmp" | "application/x-bzip" | "application/x-bzip2" | "application/x-cdf" | "application/node" | "text/javascript" | "application/x-csh" | "text/css" | "text/csv" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/dpx" | "image/emf" | "application/vnd.ms-fontobject" | "application/epub+zip" | "image/gif" | "model/gltf-binary" | "model/gltf+json" | "application/gzip" | "application/x-gzip" | "haptics/hjif" | "haptics/hmpg" | "text/html" | "image/vnd.microsoft.icon" | "text/calendar" | "haptics/ivs" | "application/java-archive" | "image/jpeg" | "application/json" | "application/ld+json" | "image/ktx" | "image/ktx2" | "application/vnd.apple.mpegurl" | "audio/mp4" | "video/mp4" | "text/markdown" | "application/x-mdx" | "audio/midi" | "audio/x-midi" | "audio/mpeg" | "video/mpeg" | "application/vnd.apple.installer+xml" | "application/x-ndjson" | "model/obj" | "text/plain" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "audio/ogg" | "video/ogg" | "application/ogg" | "font/otf" | "image/png" | "application/pdf" | "application/x-httpd-php" | "application/vnd.apple.pkpass" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "text/x-python" | "application/x-python-code" | "application/vnd.rar" | "text/rust" | "application/rtf" | "application/x-sh" | "application/sql" | "text/event-stream" | "image/svg+xml" | "application/x-tar" | "image/tiff" | "application/toml" | "text/typescript" | "video/mp2t" | "video/vnd.dlna.mpeg-tts" | "application/font-sfnt" | "font/ttf" | "model/vnd.usdz+zip" | "application/vnd.visio" | "text/vtt" | "application/wasm" | "audio/wav" | "video/webm" | "image/webp" | "font/woff" | "font/woff2" | "application/xhtml+xml" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/xml" | "application/vnd.mozilla.xul+xml" | "application/yaml" | "application/zip" | "application/x-zip-compressed" | "video/3gpp" | "video/3gpp2" | "application/x-7z-compressed";
|
|
468
469
|
}
|
|
469
470
|
|
|
470
471
|
export { type AllMimeTypes, type FileExtension, type FileExtensionToMimeType, type InferTopLevelPresent, MimeService, type MimeTopLevelType, type MimeType, type MimeTypeToFileExtension, type PresentMimeTopLevelTypes, extMimeMap, mimeToExt };
|
package/dist/mime/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
MimeService,
|
|
3
3
|
extMimeMap,
|
|
4
4
|
mimeToExt
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-O4BKLMFV.js";
|
|
6
|
+
import "../chunk-QBG7TFHM.js";
|
|
7
|
+
import "../chunk-IUGBPDQJ.js";
|
|
7
8
|
import "../chunk-7QVYU63E.js";
|
|
8
9
|
export {
|
|
9
10
|
MimeService,
|
package/dist/url/index.cjs
CHANGED
|
@@ -24,7 +24,137 @@ __export(url_exports, {
|
|
|
24
24
|
UrlService: () => UrlService
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(url_exports);
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
// src/utils/index.ts
|
|
29
|
+
var UtilsService = class {
|
|
30
|
+
static {
|
|
31
|
+
__name(this, "UtilsService");
|
|
32
|
+
}
|
|
33
|
+
chunkArray(arr, maxChunkLength) {
|
|
34
|
+
const chunks = Array.of();
|
|
35
|
+
let currentChunkLength = 0;
|
|
36
|
+
let currentChunk = Array.of();
|
|
37
|
+
for (const [index, val] of arr.entries()) {
|
|
38
|
+
if (val.length + currentChunkLength >= maxChunkLength) {
|
|
39
|
+
if (currentChunk.length) {
|
|
40
|
+
chunks.push(currentChunk);
|
|
41
|
+
}
|
|
42
|
+
currentChunkLength = val.length;
|
|
43
|
+
currentChunk = [val];
|
|
44
|
+
} else {
|
|
45
|
+
currentChunk.push(val);
|
|
46
|
+
currentChunkLength += val.length + 1;
|
|
47
|
+
}
|
|
48
|
+
if (arr.length === index + 1) {
|
|
49
|
+
chunks.push(currentChunk);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return chunks.length ? chunks : [arr];
|
|
53
|
+
}
|
|
54
|
+
b64ToBlob(b64Data) {
|
|
55
|
+
{
|
|
56
|
+
const sliceSize = 512;
|
|
57
|
+
const typeMatch = /^data:((?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*);base64,(.+)$/i.exec(
|
|
58
|
+
b64Data
|
|
59
|
+
);
|
|
60
|
+
if (!typeMatch) {
|
|
61
|
+
throw new Error(`${b64Data} is not a valid data Url`);
|
|
62
|
+
}
|
|
63
|
+
const type = typeMatch[1];
|
|
64
|
+
const base64Data = typeMatch?.[2] ?? "";
|
|
65
|
+
const byteCharacters = Buffer.from(base64Data, "base64").toString(
|
|
66
|
+
"binary"
|
|
67
|
+
);
|
|
68
|
+
const byteArrays = Array.of();
|
|
69
|
+
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
70
|
+
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
71
|
+
const byteNumbers = new Array(slice.length);
|
|
72
|
+
for (let i = 0; i < slice.length; i++) {
|
|
73
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
74
|
+
}
|
|
75
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
76
|
+
byteArrays.push(byteArray);
|
|
77
|
+
}
|
|
78
|
+
const blob = new Blob(byteArrays, { type });
|
|
79
|
+
return blob;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
arrToArrOfArrs = /* @__PURE__ */ __name(({
|
|
83
|
+
arrToFragment = Array.of(),
|
|
84
|
+
arrOfArrsAggregator = Array.of(),
|
|
85
|
+
interval
|
|
86
|
+
}) => new Promise(
|
|
87
|
+
(resolve, _reject) => resolve(
|
|
88
|
+
((interval2) => {
|
|
89
|
+
for (let i = 0; i <= arrToFragment.length; i++) {
|
|
90
|
+
if ((i % interval2 === 0 || i === 0) && i <= arrToFragment.length) {
|
|
91
|
+
let segment = arrToFragment.slice(i, i + interval2);
|
|
92
|
+
arrOfArrsAggregator.push(segment);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})(interval)
|
|
96
|
+
)
|
|
97
|
+
).then((_) => arrOfArrsAggregator), "arrToArrOfArrs");
|
|
98
|
+
extractTuple(obj, props) {
|
|
99
|
+
return [props, obj[props]];
|
|
100
|
+
}
|
|
101
|
+
sort(obj, order) {
|
|
102
|
+
return Object.fromEntries(
|
|
103
|
+
Object.entries(obj).sort(
|
|
104
|
+
([a, _aa], [b, _bb]) => order === "DESC" ? b.localeCompare(a) - a.localeCompare(b) : a.localeCompare(b) - b.localeCompare(a)
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
excludeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
109
|
+
const resolve = Object.fromEntries(
|
|
110
|
+
Object.entries(obj).map(([key, val]) => {
|
|
111
|
+
if (props.includes(key)) {
|
|
112
|
+
return ["omit", "omit"];
|
|
113
|
+
} else return [key, val];
|
|
114
|
+
}).filter(([t, _v]) => /omit/.test(t) === false)
|
|
115
|
+
);
|
|
116
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
117
|
+
}, "excludeTargeted");
|
|
118
|
+
includeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
|
|
119
|
+
const resolve = Object.fromEntries(
|
|
120
|
+
props.map((val) => this.extractTuple(obj, val))
|
|
121
|
+
);
|
|
122
|
+
return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
|
|
123
|
+
}, "includeTargeted");
|
|
124
|
+
countsSorter = /* @__PURE__ */ __name((counter, keySort = "ASC", valSort = "DESC") => Object.fromEntries(
|
|
125
|
+
Array.from(Object.entries(counter)).sort(
|
|
126
|
+
([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
|
|
127
|
+
).sort(([aStr, aNum], [bStr, bNum]) => {
|
|
128
|
+
if (typeof (aNum && bNum) === "number") {
|
|
129
|
+
return valSort === "ASC" ? aNum - bNum : bNum - aNum;
|
|
130
|
+
} else if (typeof (aNum && bNum) === "string") {
|
|
131
|
+
return valSort === "ASC" ? aStr.localeCompare(bStr) - bStr.localeCompare(aStr) : bStr.localeCompare(aStr) - aStr.localeCompare(bStr);
|
|
132
|
+
} else
|
|
133
|
+
throw new Error(
|
|
134
|
+
"only Record<string, string> and Record<string,number> types supported"
|
|
135
|
+
);
|
|
136
|
+
})
|
|
137
|
+
), "countsSorter");
|
|
138
|
+
range(from, to) {
|
|
139
|
+
const values = Array.of();
|
|
140
|
+
for (let i = from; i < to; i++) {
|
|
141
|
+
values.push(i);
|
|
142
|
+
}
|
|
143
|
+
return values;
|
|
144
|
+
}
|
|
145
|
+
isPrimeNumber = /* @__PURE__ */ __name((n) => {
|
|
146
|
+
for (let i = 2; n > i; i++) {
|
|
147
|
+
if (n % i === 0) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return n > 1;
|
|
152
|
+
}, "isPrimeNumber");
|
|
153
|
+
acceptor = /* @__PURE__ */ __name((num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber), "acceptor");
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/url/index.ts
|
|
157
|
+
var UrlService = class extends UtilsService {
|
|
28
158
|
static {
|
|
29
159
|
__name(this, "UrlService");
|
|
30
160
|
}
|
package/dist/url/index.d.cts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { UtilsService } from '../utils/index.cjs';
|
|
2
|
+
import '../types/index.cjs';
|
|
3
|
+
import 'stream';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
|
|
1
6
|
type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
|
|
2
7
|
type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
|
|
3
8
|
type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
|
|
@@ -12,7 +17,7 @@ type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXT
|
|
|
12
17
|
* ```
|
|
13
18
|
*/
|
|
14
19
|
type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
|
|
15
|
-
declare class UrlService {
|
|
20
|
+
declare class UrlService extends UtilsService {
|
|
16
21
|
private URL_REGEX;
|
|
17
22
|
parseUrl(url: string): {
|
|
18
23
|
href: string;
|
package/dist/url/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { UtilsService } from '../utils/index.js';
|
|
2
|
+
import '../types/index.js';
|
|
3
|
+
import 'stream';
|
|
4
|
+
import 'buffer';
|
|
5
|
+
|
|
1
6
|
type HandleQueryParamsOrHash<T> = T extends `${infer X}?${string}` ? X : T extends `${infer X}#${string}` ? X : T;
|
|
2
7
|
type SplitForwardSlash<S extends string> = S extends `${infer First}/${infer Rest}` ? [First, ...SplitForwardSlash<Rest>] : S extends "" ? [] : [S];
|
|
3
8
|
type LastSegment<T extends unknown[]> = T extends [...infer _, infer L] ? L : never;
|
|
@@ -12,7 +17,7 @@ type InferExtensionIfPresent<L> = L extends `${string}.${infer F}` ? F : "NO_EXT
|
|
|
12
17
|
* ```
|
|
13
18
|
*/
|
|
14
19
|
type UrlFileExt<S extends string> = InferExtensionIfPresent<LastSegment<SplitForwardSlash<HandleQueryParamsOrHash<S>>>>;
|
|
15
|
-
declare class UrlService {
|
|
20
|
+
declare class UrlService extends UtilsService {
|
|
16
21
|
private URL_REGEX;
|
|
17
22
|
parseUrl(url: string): {
|
|
18
23
|
href: string;
|
package/dist/url/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d0paminedriven/fs",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "convenient fs helpers",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"tsx": "^4.20.4",
|
|
65
65
|
"typescript": "^5.9.2",
|
|
66
66
|
"typescript-eslint": "^8.40.0",
|
|
67
|
-
"@d0paminedriven/eslint-config": "0.1.0",
|
|
68
67
|
"@d0paminedriven/prettier-config": "0.1.0",
|
|
69
|
-
"@d0paminedriven/tsconfig": "0.1.0"
|
|
68
|
+
"@d0paminedriven/tsconfig": "0.1.0",
|
|
69
|
+
"@d0paminedriven/eslint-config": "0.1.0"
|
|
70
70
|
},
|
|
71
71
|
"prettier": "@d0paminedriven/prettier-config",
|
|
72
72
|
"scripts": {
|