CodeSampleX

Пример

tar-fs 3.1.4

Проверенный пример — npm tar-fs 3.1.4. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: tar-fs exports pack and extract functions…

sha256:fdf70d3170d9e513b1055e7466419c8f5441cfca08feed3f0cabeb4d4d54d634

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. MIT-0

Свидетельства выполнения

Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.

Основа свидетельства
Подписанный контракт пройден
Квитанции проверки
1
Ключи подписи, собравшие его
1
Заявленная среда node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Среды запусков проверки

Окружение Контракт Этапы Запуск
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-11-29

Кейс

HOW
Цель
verify pkg:npm/tar-fs@3.1.4
Пакеты
Окружение
node 22.23.2
Создан
2026-11-29T02:54:52Z

Контракт

  1. tar-fs exports pack and extract functions returning readable and writable streams
  2. tar-fs.pack and tar-fs.extract round-trip files, nested directories, and relative symlinks preserving contents and link targets
  3. tar-fs.pack with entries archives only listed paths and rejects entries outside the source root with an invalid path error
  4. tar-fs.pack with ignore excludes matching files and dereference packs symlinks as regular files
  5. tar-fs.pack map transforms entry headers and tar-fs.extract strip removes leading path components while skipping root-stripped files
  6. tar-fs.extract ignore skips matching entries and mapStream transforms extracted file contents on the fly
  7. tar-fs.extract strips setuid, setgid, and sticky permission bits from extracted files
  8. tar-fs.extract rejects archive entries containing '..' path traversal segments
  9. tar-fs.extract rejects symlinks whose target escapes the extraction root

Файлы

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Скачать артефакт с исходным кодом (tar.gz)

Исходный код

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pkg:npm/tar-fs@3.1.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/tar-fs@3.1.4
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:790708df770ef220adc50045934ee2230329b592e18253d938b3003b0f824236","constraints":{"executionContext":"node"},"contract":["tar-fs exports pack and extract functions returning readable and writable streams","tar-fs.pack and tar-fs.extract round-trip files, nested directories, and relative symlinks preserving contents and link targets","tar-fs.pack with entries archives only listed paths and rejects entries outside the source root with an invalid path error","tar-fs.pack with ignore excludes matching files and dereference packs symlinks as regular files","tar-fs.pack map transforms entry headers and tar-fs.extract strip removes leading path components while skipping root-stripped files","tar-fs.extract ignore skips matching entries and mapStream transforms extracted file contents on the fly","tar-fs.extract strips setuid, setgid, and sticky permission bits from extracted files","tar-fs.extract rejects archive entries containing '..' path traversal segments","tar-fs.extract rejects symlinks whose target escapes the extraction root"],"goal":"verify pkg:npm/tar-fs@3.1.4","kind":"HOW","packages":["pkg:npm/tar-fs@3.1.4"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/tar-fs@3.1.4"],"schemaVersion":1,"subject":"pkg:npm/tar-fs@3.1.4","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "tar-fs-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "tar-fs-sample",
      "version": "1.0.0",
      "dependencies": {
        "tar-fs": "3.1.4"
      }
    },
    "node_modules/b4a": {
      "version": "1.9.0",
      "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.9.0.tgz",
      "integrity": "sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ==",
      "license": "Apache-2.0",
      "peerDependencies": {
        "react-native-b4a": "*"
      },
      "peerDependenciesMeta": {
        "react-native-b4a": {
          "optional": true
        }
      }
    },
    "node_modules/bare-buffer": {
      "version": "3.7.3",
      "resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.3.tgz",
      "integrity": "sha512-77owW16RX6YgdOzddHtM0oGz8wsd0/F9k/0coz6TPmjUHnr/9FwWODVMNKwyYWM/a/ESdTum855nfQxnsKUygA==",
      "license": "Apache-2.0",
      "engines": {
        "bare": ">=1.20.0"
      }
    },
    "node_modules/bare-events": {
      "version": "2.9.2",
      "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
      "integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==",
      "license": "Apache-2.0",
      "peerDependencies": {
        "bare-abort-controller": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        }
      }
    },
    "node_modules/bare-fs": {
      "version": "4.8.7",
      "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.7.tgz",
      "integrity": "sha512-bNBjq+x9Wezp3risJs7TaPH3jjVnyFmmSSxfpES8tp9xjvL4t6Bk9v2nC+xm5lfxJeDzChK7NBryK+JciM/pfQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.5.4",
        "bare-path": "^3.0.0",
        "bare-stream": "^2.6.4",
        "bare-url": "^2.2.2",
        "fast-fifo": "^1.3.2"
      },
      "engines": {
        "bare": ">=1.28.0"
      },
      "peerDependencies": {
        "bare-buffer": "*"
      },
      "peerDependenciesMeta": {
        "bare-buffer": {
          "optional": true
        }
      }
    },
    "node_modules/bare-path": {
      "version": "3.1.3",
      "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.3.tgz",
      "integrity": "sha512-8r+FVU/o4zcFmpCDqbqAYhHHbtXPP+cyZKo7DRGRWc7OLlNs4TMaSQEpXL/sIdzyEG0M7RHw4B7xYMGrTc+qrg==",
      "license": "Apache-2.0"
    },
    "node_modules/bare-stream": {
      "version": "2.13.4",
      "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.4.tgz",
      "integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.8.1",
        "streamx": "^2.25.0",
        "teex": "^1.0.1"
      },
      "peerDependencies": {
        "bare-abort-controller": "*",
        "bare-buffer": "*",
        "bare-events": "*"
      },
      "peerDependenciesMeta": {
        "bare-abort-controller": {
          "optional": true
        },
        "bare-buffer": {
          "optional": true
        },
        "bare-events": {
          "optional": true
        }
      }
    },
    "node_modules/bare-url": {
      "version": "2.5.8",
      "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.8.tgz",
      "integrity": "sha512-G5KTe5Bj6z5pqIxcn3lWlIFIv0rkXbccx0T0Xuf7t4RapfSWvFlcVbrwYXxFZ00PC4lp57OCIk6uXP/r3GbpDw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-buffer": "^3.0.0",
        "bare-path": "^3.0.0"
      }
    },
    "node_modules/end-of-stream": {
      "version": "1.4.5",
      "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
      "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
      "license": "MIT",
      "dependencies": {
        "once": "^1.4.0"
      }
    },
    "node_modules/events-universal": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
      "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
      "license": "Apache-2.0",
      "dependencies": {
        "bare-events": "^2.7.0"
      }
    },
    "node_modules/fast-fifo": {
      "version": "1.3.2",
      "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
      "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
      "license": "MIT"
    },
    "node_modules/once": {
      "version": "1.4.0",
      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
      "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
      "license": "ISC",
      "dependencies": {
        "wrappy": "1"
      }
    },
    "node_modules/pump": {
      "version": "3.0.4",
      "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
      "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
      "license": "MIT",
      "dependencies": {
        "end-of-stream": "^1.1.0",
        "once": "^1.3.1"
      }
    },
    "node_modules/streamx": {
      "version": "2.28.1",
      "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz",
      "integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==",
      "license": "MIT",
      "dependencies": {
        "events-universal": "^1.0.0",
        "fast-fifo": "^1.3.2",
        "text-decoder": "^1.1.0"
      }
    },
    "node_modules/tar-fs": {
      "version": "3.1.4",
      "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.4.tgz",
      "integrity": "sha512-S0lrlrJkynj6otwBGsd+1YHWvbgac42+LeHavSzgokehNdiRg1D4eGFDi1cceiG1fQlSTnnss+agdRQl5Bb1DA==",
      "license": "MIT",
      "dependencies": {
        "pump": "^3.0.0",
        "tar-stream": "^3.3.0"
      },
      "optionalDependencies": {
        "bare-fs": "^4.0.1",
        "bare-path": "^3.0.0"
      }
    },
    "node_modules/tar-stream": {
      "version": "3.3.0",
      "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.3.0.tgz",
      "integrity": "sha512-rQZZfW2Q4YDCFJyP8KFDG+gfMzcOHaMYq0gb9jzH2gsK0P5qXVpu+UoKE1qaZcs3/R6QVkJr2228nlZoM1V5PA==",
      "license": "MIT",
      "dependencies": {
        "b4a": "^1.9.0",
        "bare-fs": "^4.8.2",
        "fast-fifo": "^1.3.2",
        "streamx": "^2.28.1"
      }
    },
    "node_modules/teex": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
      "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
      "license": "MIT",
      "dependencies": {
        "streamx": "^2.12.5"
      }
    },
    "node_modules/text-decoder": {
      "version": "1.2.7",
      "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
      "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "b4a": "^1.6.4"
      }
    },
    "node_modules/wrappy": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
      "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
      "license": "ISC"
    }
  }
}
package.json
{
  "name": "tar-fs-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Minimal sample verifying tar-fs@3.1.4 pack and extract behavior",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.js"
  },
  "dependencies": {
    "tar-fs": "3.1.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/tar-fs@3.1.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/tar-fs@3.1.4"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
'use strict'

const { Readable } = require('node:stream')
const { pipeline } = require('node:stream/promises')
const tarFs = require('tar-fs')

function packDirectory (srcDir, opts = {}) {
  return tarFs.pack(srcDir, opts)
}

function extractDirectory (destDir, opts = {}) {
  return tarFs.extract(destDir, opts)
}

async function copyDirectory (srcDir, destDir, packOpts = {}, extractOpts = {}) {
  await pipeline(
    tarFs.pack(srcDir, packOpts),
    tarFs.extract(destDir, extractOpts)
  )
}

async function packToBuffer (srcDir, opts = {}) {
  const chunks = []
  const stream = tarFs.pack(srcDir, opts)
  for await (const chunk of stream) {
    chunks.push(chunk)
  }
  return Buffer.concat(chunks)
}

async function extractFromBuffer (tarBuffer, destDir, opts = {}) {
  await pipeline(
    Readable.from([tarBuffer]),
    tarFs.extract(destDir, opts)
  )
}

module.exports = {
  tarFs,
  packDirectory,
  extractDirectory,
  copyDirectory,
  packToBuffer,
  extractFromBuffer
}
test/contract.js
'use strict'

const assert = require('node:assert/strict')
const fs = require('node:fs')
const os = require('node:os')
const path = require('node:path')
const { Transform } = require('node:stream')
const {
  tarFs,
  packDirectory,
  extractDirectory,
  copyDirectory,
  packToBuffer,
  extractFromBuffer
} = require('../src/index.js')

function makeTempDir (prefix) {
  return fs.mkdtempSync(path.join(os.tmpdir(), prefix))
}

async function main () {
  const root = makeTempDir('tar-fs-contract-')
  try {
    // 1. Export surface and stream shapes
    assert.equal(typeof tarFs.pack, 'function')
    assert.equal(typeof tarFs.extract, 'function')

    const src = path.join(root, 'src')
    fs.mkdirSync(path.join(src, 'nested'), { recursive: true })
    fs.writeFileSync(path.join(src, 'hello.txt'), 'hello tar-fs\n', 'utf8')
    fs.writeFileSync(path.join(src, 'skip.log'), 'ignored content\n', 'utf8')
    fs.writeFileSync(path.join(src, 'nested', 'data.txt'), 'nested payload\n', 'utf8')
    fs.symlinkSync('hello.txt', path.join(src, 'hello-link.txt'))

    const probePack = packDirectory(src)
    assert.equal(typeof probePack.pipe, 'function')
    assert.equal(typeof probePack.read, 'function')
    probePack.destroy()

    const probeExtract = extractDirectory(path.join(root, 'probe-dest'))
    assert.equal(typeof probeExtract.write, 'function')
    assert.equal(typeof probeExtract.end, 'function')
    probeExtract.destroy()

    // 2. Round-trip pack and extract preserving hierarchy, contents, and relative symlink
    const destBasic = path.join(root, 'dest-basic')
    await copyDirectory(src, destBasic)

    assert.equal(fs.readFileSync(path.join(destBasic, 'hello.txt'), 'utf8'), 'hello tar-fs\n')
    assert.equal(fs.readFileSync(path.join(destBasic, 'nested', 'data.txt'), 'utf8'), 'nested payload\n')
    assert.equal(fs.lstatSync(path.join(destBasic, 'hello-link.txt')).isSymbolicLink(), true)
    assert.equal(fs.readlinkSync(path.join(destBasic, 'hello-link.txt')), 'hello.txt')

    // 3. pack with entries option includes only specified paths; outside-cwd entries are rejected
    const destEntries = path.join(root, 'dest-entries')
    await copyDirectory(src, destEntries, { entries: ['nested/data.txt'] })
    assert.equal(fs.existsSync(path.join(destEntries, 'nested', 'data.txt')), true)
    assert.equal(fs.existsSync(path.join(destEntries, 'hello.txt')), false)

    await assert.rejects(
      () => packToBuffer(src, { entries: ['../outside.txt'] }),
      /is not a valid path/
    )

    // 4. pack with ignore excludes matching files, and dereference packs symlinks as regular files
    const destDeref = path.join(root, 'dest-deref')
    await copyDirectory(src, destDeref, {
      dereference: true,
      ignore: (name) => name.endsWith('.log')
    })
    assert.equal(fs.existsSync(path.join(destDeref, 'skip.log')), false)
    assert.equal(fs.lstatSync(path.join(destDeref, 'hello-link.txt')).isFile(), true)
    assert.equal(fs.lstatSync(path.join(destDeref, 'hello-link.txt')).isSymbolicLink(), false)
    assert.equal(fs.readFileSync(path.join(destDeref, 'hello-link.txt'), 'utf8'), 'hello tar-fs\n')

    // 5. pack with map prefixes paths; extract with strip removes leading component and drops root-stripped files
    const mappedTar = await packToBuffer(src, {
      entries: ['hello.txt', 'nested/data.txt'],
      map: (header) => {
        if (header.name === 'nested/data.txt') {
          header.name = 'prefix/sub/data.txt'
        }
        return header
      }
    })
    const destStrip = path.join(root, 'dest-strip')
    await extractFromBuffer(mappedTar, destStrip, { strip: 1 })
    assert.equal(fs.existsSync(path.join(destStrip, 'hello.txt')), false)
    assert.equal(fs.readFileSync(path.join(destStrip, 'sub', 'data.txt'), 'utf8'), 'nested payload\n')

    // 6. extract with ignore skips entries and mapStream transforms file data on the fly
    const plainTar = await packToBuffer(src, { entries: ['hello.txt', 'skip.log'] })
    const destTransform = path.join(root, 'dest-transform')
    await extractFromBuffer(plainTar, destTransform, {
      ignore: (_name, header) => header.name.endsWith('.log'),
      mapStream: (fileStream) => {
        const upper = new Transform({
          transform (chunk, _enc, cb) {
            cb(null, Buffer.from(chunk.toString('utf8').toUpperCase(), 'utf8'))
          }
        })
        return fileStream.pipe(upper)
      }
    })
    assert.equal(fs.existsSync(path.join(destTransform, 'skip.log')), false)
    assert.equal(fs.readFileSync(path.join(destTransform, 'hello.txt'), 'utf8'), 'HELLO TAR-FS\n')

    // 7. extract strips setuid/setgid/sticky special permission bits
    const specialModeTar = await packToBuffer(src, {
      entries: ['hello.txt'],
      map: (header) => {
        header.mode = 0o4755
        return header
      }
    })
    const destMode = path.join(root, 'dest-mode')
    await extractFromBuffer(specialModeTar, destMode)
    const extractedMode = fs.statSync(path.join(destMode, 'hello.txt')).mode
    assert.equal(extractedMode & 0o7000, 0)

    // 8. extract rejects path traversal entries containing '..'
    const traversalTar = await packToBuffer(src, {
      entries: ['hello.txt'],
      map: (header) => {
        if (header.type === 'file') {
          header.name = '../escaped.txt'
        }
        return header
      }
    })
    const destTraversal = path.join(root, 'dest-traversal')
    await assert.rejects(
      () => extractFromBuffer(traversalTar, destTraversal),
      /is not a valid path/
    )
    assert.equal(fs.existsSync(path.join(root, 'escaped.txt')), false)

    // 9. extract rejects symlinks whose target escapes the extraction root
    const escapeSrc = path.join(root, 'escape-src')
    fs.mkdirSync(escapeSrc, { recursive: true })
    fs.symlinkSync('../outside-target.txt', path.join(escapeSrc, 'bad-link'))
    const escapeSymlinkTar = await packToBuffer(escapeSrc)
    const destSymlink = path.join(root, 'dest-symlink')
    await assert.rejects(
      () => extractFromBuffer(escapeSymlinkTar, destSymlink),
      /is not a valid symlink/
    )
    assert.equal(fs.existsSync(path.join(destSymlink, 'bad-link')), false)

    console.log('tar-fs@3.1.4 contract passed')
  } finally {
    fs.rmSync(root, { recursive: true, force: true })
  }
}

main().catch((err) => {
  console.error(err)
  process.exit(1)
})

Исходный сидер

аноним