Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@std/tar try to "create current directoy" which must be already exists (Include solution) #6114

Open
h76oeI6pMxU9g4p8aCpc6Q opened this issue Oct 13, 2024 · 1 comment
Labels
bug Something isn't working needs triage

Comments

@h76oeI6pMxU9g4p8aCpc6Q
Copy link

let { UntarStream } = await import('jsr:@std/tar/untar-stream')
let { dirname, normalize } = await import('jsr:@std/path')
let { ensureDir } = await import('jsr:@std/fs')

let url = 'https://bitcoincore.org/bin/bitcoin-core-28.0/bitcoin-28.0-x86_64-linux-gnu.tar.gz'

for await (let entry of (await fetch(url)).body?.pipeThrough(new DecompressionStream('gzip')).pipeThrough(new UntarStream())) {

    let path = normalize(entry.path)
    await Deno.mkdir(dirname(path)) // Bug Here
    // await ensureDir(dirname(path)) // Solution Here
    await entry.readable?.pipeTo((await Deno.create(path)).writable)
}

Reference:
https://jsr.io/@std/tar

Environment:
Ubuntu 24.10
Deno 2.0.0

@h76oeI6pMxU9g4p8aCpc6Q h76oeI6pMxU9g4p8aCpc6Q added bug Something isn't working needs triage labels Oct 13, 2024
@BlackAsLight
Copy link
Contributor

#6113

I'm a little ahead of you. Changing it to await Deno.mkdir(dirname(path), { recursive: true }) fixes your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants