Compare commits
No commits in common. "a9cf2a1d210444bc37988b02b4a0dfbf0db9a4b9" and "b41f37efa7fe39bed93eb392bc63b1a96ee3a051" have entirely different histories.
a9cf2a1d21
...
b41f37efa7
|
@ -21,7 +21,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@parcel/fs": "^2.8.3",
|
"@parcel/fs": "^2.8.3",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"file-saver": "^2.0.5",
|
|
||||||
"memfs": "^3.4.13",
|
"memfs": "^3.4.13",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
import { Terminal } from 'xterm';
|
|
||||||
import { saveAs } from 'file-saver';
|
|
||||||
const fs = require('../fs');
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param { string[] } argv
|
|
||||||
* @param { Terminal } terminal
|
|
||||||
*/
|
|
||||||
module.exports = (argv, terminal) => {
|
|
||||||
if (argv.indexOf('--help') != -1 || argv.length == 1) {
|
|
||||||
terminal.write(
|
|
||||||
`Usage: ${argv[0]} [FILES] [-z]
|
|
||||||
Export file from filesystem to your device.
|
|
||||||
-z Compress in zip format (not supported)`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let files = [...argv];
|
|
||||||
files.shift();
|
|
||||||
|
|
||||||
if (argv.indexOf('-z') != -1) {
|
|
||||||
terminal.write(`${argv[0]}: cannot zip '${files.join(' ').replace('\'', "\\'")}': not supported\n`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var isFileSaverSupported = !!new Blob;
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
if (!isFileSaverSupported) {
|
|
||||||
terminal.write(`${argv[0]}: Your browser does not support this feature.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(argv[1])) {
|
|
||||||
terminal.write(`${argv[0]}: cannot open ${argv[1]}: no such file or directory\n`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
saveAs(new Blob([fs.readFileSync(argv[1])]), argv[1]);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ let cmds = {
|
||||||
'skills': require('./skills'),
|
'skills': require('./skills'),
|
||||||
'mkdir': require('./mkdir'),
|
'mkdir': require('./mkdir'),
|
||||||
'wget': require('./wget'),
|
'wget': require('./wget'),
|
||||||
'export_file': require('./export_file'),
|
|
||||||
|
|
||||||
// alias l='ls -l'
|
// alias l='ls -l'
|
||||||
'l': (a,t) => {require('./ls')([...a, '-l'], t)},
|
'l': (a,t) => {require('./ls')([...a, '-l'], t)},
|
||||||
|
|
|
@ -41,7 +41,7 @@ Usage: ${argv[0]} [URL] [-O out.file] [-V] [-Q] [-s]
|
||||||
if (filepath == '-') {
|
if (filepath == '-') {
|
||||||
terminal.write(file);
|
terminal.write(file);
|
||||||
} else {
|
} else {
|
||||||
fs.writeFileSync(filepath, new Buffer(file));
|
fs.writeFileSync(filepath, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Usage: ${argv[0]} [URL] [-O out.file] [-V] [-Q] [-s]
|
||||||
req.onprogress = progress;
|
req.onprogress = progress;
|
||||||
req.onload = (e) => {
|
req.onload = (e) => {
|
||||||
if (e.type == 'load') {
|
if (e.type == 'load') {
|
||||||
write(req.response);
|
write(e.response);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
req.send();
|
req.send();
|
||||||
|
|
Loading…
Reference in New Issue