Last active
March 29, 2020 11:22
-
-
Save plugn/0a390b2f45223deaefde85968fb7f1ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// console.log `this` | |
{ | |
console: { | |
log: function log() | |
}, | |
scriptArgs: [], | |
print: function print(), | |
__loadScript: function __loadScript(), | |
os: { | |
O_APPEND: 8, | |
O_CREAT: 512, | |
O_EXCL: 2048, | |
O_RDONLY: 0, | |
O_RDWR: 2, | |
O_TRUNC: 1024, | |
O_WRONLY: 1, | |
SIGABRT: 6, | |
SIGALRM: 14, | |
SIGCHLD: 20, | |
SIGCONT: 19, | |
SIGFPE: 8, | |
SIGILL: 4, | |
SIGINT: 2, | |
SIGPIPE: 13, | |
SIGQUIT: 3, | |
SIGSEGV: 11, | |
SIGSTOP: 17, | |
SIGTERM: 15, | |
SIGTSTP: 18, | |
SIGTTIN: 21, | |
SIGTTOU: 22, | |
SIGUSR1: 30, | |
SIGUSR2: 31, | |
S_IFBLK: 24576, | |
S_IFCHR: 8192, | |
S_IFDIR: 16384, | |
S_IFIFO: 4096, | |
S_IFLNK: 40960, | |
S_IFMT: 61440, | |
S_IFREG: 32768, | |
S_IFSOCK: 49152, | |
S_ISGID: 1024, | |
S_ISUID: 2048, | |
WNOHANG: 1, | |
chdir: function chdir(), | |
clearTimeout: function clearTimeout(), | |
close: function close(), | |
dup: function dup(), | |
dup2: function dup2(), | |
exec: function exec(), | |
getcwd: function getcwd(), | |
isatty: function isatty(), | |
kill: function kill(), | |
lstat: function lstat(), | |
mkdir: function mkdir(), | |
open: function open(), | |
pipe: function pipe(), | |
platform: "darwin", | |
read: function read(), | |
readdir: function readdir(), | |
readlink: function readlink(), | |
realpath: function realpath(), | |
remove: function remove(), | |
rename: function rename(), | |
seek: function seek(), | |
setReadHandler: function setReadHandler(), | |
setTimeout: function setTimeout(), | |
setWriteHandler: function setWriteHandler(), | |
signal: function signal(), | |
sleep: function sleep(), | |
stat: function stat(), | |
symlink: function symlink(), | |
ttyGetWinSize: function ttyGetWinSize(), | |
ttySetRaw: function ttySetRaw(), | |
utimes: function utimes(), | |
waitpid: function waitpid(), | |
write: function write() | |
}, | |
std: { | |
Error: {}, | |
SEEK_CUR: 1, | |
SEEK_END: 2, | |
SEEK_SET: 0, | |
err: {}, | |
evalScript: function evalScript(), | |
exit: function exit(), | |
fdopen: function fdopen(), | |
gc: function gc(), | |
getenv: function getenv(), | |
in: {}, | |
loadFile: function loadFile(), | |
loadScript: function loadScript(), | |
open: function open(), | |
out: {}, | |
popen: function popen(), | |
printf: function printf(), | |
puts: function puts(), | |
sprintf: function sprintf(), | |
strerror: function strerror(), | |
tmpfile: function tmpfile(), | |
urlGet: function urlGet() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REPL | |
// JS timeout: os.setTimeout | |
os.setTimeout(() => { console.log('DINO') }, 800) | |
// OS layer | |
// qjs > os.ttyGetWinSize() | |
// [ 58, 22 ] | |
// curl and output text by lines | |
std.urlGet('https://r0.ru/').split(/\n+/).forEach(line => {console.log(line)}) | |
// JSON module | |
// qjs > | |
JSON.stringify([{a:'a'}, {b:'b'}]) | |
// "[{\"a\":\"a\"},{\"b\":\"b\"}]" | |
// qjs > | |
JSON.parse(JSON.stringify([{a:'a'}, {b:'b'}])) | |
// [ { a: "a" }, { b: "b" } ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment