mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
File type terminal tool
This commit is contained in:
@@ -33,6 +33,7 @@ export const commands: Record<string, string> = {
|
||||
echo: "Displays messages that are passed to it.",
|
||||
exit: "Quits the command interpreter.",
|
||||
ffmpeg: "Convert audio or video file to another format.",
|
||||
file: "Detects the MIME type of the file.",
|
||||
find: "Searches for a text string in a file or files.",
|
||||
git: "Read from git repositories.",
|
||||
help: "Provides Help information for commands.",
|
||||
@@ -95,6 +96,7 @@ const directoryCommands = new Set([
|
||||
"dir",
|
||||
"erase",
|
||||
"ffmpeg",
|
||||
"file",
|
||||
"imagemagick",
|
||||
"ls",
|
||||
"md",
|
||||
|
||||
@@ -335,6 +335,22 @@ const useCommandInterpreter = (
|
||||
case "quit":
|
||||
closeWithTransition(id);
|
||||
break;
|
||||
case "file": {
|
||||
const [commandPath] = commandArgs;
|
||||
|
||||
if (commandPath) {
|
||||
const fullPath = getFullPath(commandPath);
|
||||
|
||||
if (await exists(fullPath)) {
|
||||
const { fileTypeFromBuffer } = await import("file-type");
|
||||
const { mime = "Unknown" } =
|
||||
(await fileTypeFromBuffer(await readFile(fullPath))) || {};
|
||||
|
||||
localEcho?.println(`${commandPath}: ${mime}`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "find":
|
||||
case "search": {
|
||||
const results = await fullSearch(
|
||||
|
||||
@@ -6,6 +6,8 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
enabled: isProduction,
|
||||
});
|
||||
|
||||
const webpack = require("webpack");
|
||||
|
||||
/**
|
||||
* @type {import("next").NextConfig}
|
||||
* */
|
||||
@@ -26,6 +28,26 @@ const nextConfig = {
|
||||
optimizeFonts: false,
|
||||
reactStrictMode: true,
|
||||
swcMinify: !isProduction,
|
||||
webpack: (config) => {
|
||||
config.plugins.push(
|
||||
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
|
||||
const mod = resource.request.replace(/^node:/, "");
|
||||
|
||||
switch (mod) {
|
||||
case "buffer":
|
||||
resource.request = "buffer";
|
||||
break;
|
||||
case "stream":
|
||||
resource.request = "readable-stream";
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Not found ${mod}`);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
return config;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = withBundleAnalyzer(nextConfig);
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
"@wasmer/wasmfs": "^0.12.0",
|
||||
"ani-cursor": "^0.0.5",
|
||||
"fflate": "^0.7.3",
|
||||
"file-type": "^17.1.1",
|
||||
"framer-motion": "^6.3.2",
|
||||
"gif.js": "^0.2.0",
|
||||
"html-to-image": "^1.9.0",
|
||||
|
||||
30
yarn.lock
30
yarn.lock
@@ -2787,6 +2787,15 @@ file-type@^11.0.0:
|
||||
resolved "https://registry.yarnpkg.com/file-type/-/file-type-11.1.0.tgz#93780f3fed98b599755d846b99a1617a2ad063b8"
|
||||
integrity sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==
|
||||
|
||||
file-type@^17.1.1:
|
||||
version "17.1.1"
|
||||
resolved "https://registry.yarnpkg.com/file-type/-/file-type-17.1.1.tgz#24c59bc663df0c0c181b31dfacde25e06431afbe"
|
||||
integrity sha512-heRUMZHby2Qj6wZAA3YHeMlRmZNQTcb6VxctkGmM+mcM6ROQKvHpr7SS6EgdfEhH+s25LDshBjvPx/Ecm+bOVQ==
|
||||
dependencies:
|
||||
readable-web-to-node-stream "^3.0.2"
|
||||
strtok3 "^7.0.0-alpha.7"
|
||||
token-types "^5.0.0-alpha.2"
|
||||
|
||||
fill-range@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
||||
@@ -4789,6 +4798,11 @@ peek-readable@^4.1.0:
|
||||
resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-4.1.0.tgz#4ece1111bf5c2ad8867c314c81356847e8a62e72"
|
||||
integrity sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==
|
||||
|
||||
peek-readable@^5.0.0-alpha.5:
|
||||
version "5.0.0-alpha.5"
|
||||
resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz#ace5dfedf7bc33f17c9b5170b9d54f69a4fba79b"
|
||||
integrity sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA==
|
||||
|
||||
picocolors@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
|
||||
@@ -5697,6 +5711,14 @@ strtok3@^6.2.4, strtok3@^6.3.0:
|
||||
"@tokenizer/token" "^0.3.0"
|
||||
peek-readable "^4.1.0"
|
||||
|
||||
strtok3@^7.0.0-alpha.7:
|
||||
version "7.0.0-alpha.8"
|
||||
resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-7.0.0-alpha.8.tgz#23a7870974e0494b58b14af6dd1c2c67cf13314d"
|
||||
integrity sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA==
|
||||
dependencies:
|
||||
"@tokenizer/token" "^0.3.0"
|
||||
peek-readable "^5.0.0-alpha.5"
|
||||
|
||||
style-search@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902"
|
||||
@@ -5981,6 +6003,14 @@ token-types@^4.1.1, token-types@^4.2.0:
|
||||
"@tokenizer/token" "^0.3.0"
|
||||
ieee754 "^1.2.1"
|
||||
|
||||
token-types@^5.0.0-alpha.2:
|
||||
version "5.0.0-alpha.2"
|
||||
resolved "https://registry.yarnpkg.com/token-types/-/token-types-5.0.0-alpha.2.tgz#e43d63b2a8223a593d1c782a5149bec18f1abf97"
|
||||
integrity sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ==
|
||||
dependencies:
|
||||
"@tokenizer/token" "^0.3.0"
|
||||
ieee754 "^1.2.1"
|
||||
|
||||
totalist@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/totalist/-/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df"
|
||||
|
||||
Reference in New Issue
Block a user