download
raw
1.07 kB
import { test } from 'node:test'
import assert from 'node:assert'
import { readFile } from 'fs/promises'
import ThreadStream from '../index.js'
import { join } from 'desm'
import { file } from './helper.js'
const nodeVersion = parseInt(process.versions.node.split('.')[0], 10)
// Native TypeScript stripping (--experimental-strip-types) is only available in Node 22.6+
test('typescript module with native type stripping', { skip: nodeVersion < 22 }, async function (t) {
const dest = file()
const stream = new ThreadStream({
filename: join(import.meta.url, 'ts', 'to-file.ts'),
workerData: { dest },
workerOpts: {
execArgv: ['--experimental-strip-types', '--disable-warning=ExperimentalWarning']
},
sync: false
})
t.after(() => stream.end())
assert.ok(stream.write('hello world\n'))
assert.ok(stream.write('something else\n'))
stream.end()
await new Promise((resolve) => {
stream.on('close', resolve)
})
const data = await readFile(dest, 'utf8')
assert.strictEqual(data, 'hello world\nsomething else\n')
})

Xet Storage Details

Size:
1.07 kB
·
Xet hash:
ffcdae2c4181ca67ca7515e47985673d805a2011bd7a5bba82a88b0eb85032e1

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.