mirror of
https://github.com/aipoch/open-science.git
synced 2026-10-02 02:14:40 +08:00
Redesigns the notebook runtime subsystem around a v4 runtime registry: persistent multi-kernel execution, a per-session binding as the single source of truth, offline provisioning, disable/drain lifecycle, and crash-recoverable operation journaling. Includes review-hardening for the operation journal, tri-state crash-recovery liveness, unknown-orphan prefix blocking, unified binding gates, cache locking, and pinned+verified micromamba. Known follow-ups documented in the PR.
23 lines
798 B
JavaScript
23 lines
798 B
JavaScript
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
import { compress, init as initZstd } from '@bokuweb/zstd-wasm'
|
|
import { c as createTar } from 'tar'
|
|
import { writeFile } from 'node:fs/promises'
|
|
|
|
/** @type {Promise<void> | undefined} */
|
|
let zstdReady
|
|
|
|
/** @returns {Promise<void>} */
|
|
const ensureZstd = () => {
|
|
zstdReady ??= initZstd()
|
|
return zstdReady
|
|
}
|
|
|
|
/** @param {string} sourceDir @param {string} archivePath @returns {Promise<void>} */
|
|
export const createPackArchive = async (sourceDir, archivePath) => {
|
|
await ensureZstd()
|
|
const stream = createTar({ cwd: sourceDir, portable: true }, ['.'])
|
|
const chunks = []
|
|
for await (const chunk of stream) chunks.push(Buffer.from(chunk))
|
|
await writeFile(archivePath, Buffer.from(compress(Buffer.concat(chunks), 10)))
|
|
}
|