
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
This subproject is a kind of experiment, addressed to the google/zx/issues/589. Just a testing ground for verifying ideas and approaches aimed at improve the zx architecture.
spawn
builds a configurable exec context around the node:child_process
API.zurk
implements the API for sync and async executions.x
provides the basic template-string API.yarn add zurk
import {$, exec, zurk} from 'zurk'
const r1 = exec({sync: true, cmd: 'echo foo'})
const r2 = await zurk({sync: false, cmd: 'echo foo'})
const r3 = await $`echo foo`
const foo = $`echo foo`
const foobarbaz = (await $`echo ${foo} ${$`echo bar`} ${await $`echo baz`}`)
const p1 = $`echo foo`
const p2 = $({sync: true})`echo foo`
const o1 = (await p1).toString() // foo
const o2 = await p1.stdout // foo
const o3 = p2.stdout // foo
const input = '{"name": "foo"}'
const name = await $({input})`jq -r .name` // foo
const stdin = fs.createReadStream(path.join(fixtures, 'foo.json'))
const data = await $({stdin})`jq -r .data` // foo
const p = $`echo "5\\n3\\n1\\n4\\n2"`
const sorted = $({input: p})`sort` // 1\n2\n3\n4\n5
const result = $`echo "5\\n3\\n1\\n4\\n2"`
const piped0 = result.pipe`sort | cat` // '1\n2\n3\n4\n5'
const piped1 = result.pipe`sort`.pipe`cat` // ...
const piped2 = (await result).pipe`sort`
const piped3 = result.pipe($`sort`)
const result = $`echo 1; sleep 1; echo 2; sleep 1; echo 3`
const piped1 = result.pipe`cat`
let piped2: any
setTimeout(() => {
piped2 = result.pipe`cat`
}, 1500)
await piped1
assert.equal((await piped1).toString(), '1\n2\n3')
assert.equal((await piped2).toString(), '1\n2\n3')
const $$ = $({sync: true, cmd: 'echo foo'})
const $$$ = $$({cmd: 'echo bar'})
const p1 = $$() // foo
const p2 = $$$() // bar
const p3 = $$`echo baz` // baz
const ac = new AbortController()
const p = $({nothrow: true, ac})`sleep 10`
setTimeout(() => {
ac.signal.abort() // or just `p.abort()`
}, 500)
const { error } = await p
error.message // 'The operation was aborted'
import {type TSpawnStore, $} from 'zurk'
const getFixedSizeArray = (size: number) => {
const arr: any[] = []
return new Proxy(arr, {
get: (target: any, prop) =>
prop === 'push' && arr.length >= size
? () => {}
: target[prop]
})
}
const store: TSpawnStore = {
stdout: getFixedSizeArray(1),
stderr: getFixedSizeArray(2),
stdall: getFixedSizeArray(0)
}
const result = await $({store})`echo hello`
result.stdout // 'hello\n'
result.stdall // ''
import {quote, quotePwsh} from 'zurk'
const arg = 'foo bar'
$({quote})`echo ${arg}` // "echo $'foo bar'"
$({quote: quotePwsh})`echo ${arg}` // "echo 'foo bar'"
FAQs
A generic process spawner
We found that zurk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.