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

TypeError: Deno.write is not a function #18

Open
richcorbs opened this issue Oct 19, 2024 · 5 comments
Open

TypeError: Deno.write is not a function #18

richcorbs opened this issue Oct 19, 2024 · 5 comments

Comments

@richcorbs
Copy link

I'm using Deno 2 and trying to use compress to tar and gzip a directory on one system and then ungzip and untar the directory on another. The directory contains text and binary files.

Previously I have tried 0.4.4, and 0.4.5 and I was getting Deno.read is not a function. Updating to 0.4.6 resolved this error. Yay! Now I'm getting the Deno.write error.\

The tar file is written as expected and where expected but this Deno.write error shows up during the gzip portion. A 0-byte ".gz" file is created.

This library seems to do exactly what I need if I could get it to work.

I'll look around the code a bit to see if there is anything obvious but I'm not confident in my own skills.

Any thoughts you have are appreciated if you're reading this. :-)

$ deno run --allow-read --allow-write --allow-net --allow-run main.ts --deploy --production

<a list of my files to be included in the tar.gz file>
.....

error: Uncaught (in promise) TypeError: Deno.write is not a function
    await Deno.write(this.writer.rid, headers);
               ^
    at Writer.setup (https://deno.land/x/[email protected]/gzip/writer_gzip.ts:41:16)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async GzipStream.compress (https://deno.land/x/[email protected]/gzip/gzip_stream.ts:21:5)
    at async deploy (file:///Users/rich/Code/sssg-deno/main.ts:285:3)
    at async main (file:///Users/rich/Code/sssg-deno/main.ts:56:5)
@richcorbs
Copy link
Author

richcorbs commented Oct 19, 2024

Is it as simple as updating writer_gzip.ts:41 to use Deno.writeFile?

@richcorbs
Copy link
Author

I cloned the repo and updated writer_gzip.ts. This introduced new errors about something being a directory.

I (sloppily) coded around those errors and got it to run BUT my files were 0 byte files at the destination. :-(

@richcorbs
Copy link
Author

Another data point: I created the gzip another way and was able to use compress's gunzipFile to unzip it and uncompress to untar it.

@fuxingZhang
Copy link
Contributor

@richcorbs
I haven't done js/ts related work for more than five years, and I don't have the ability to maintain it now.

Solution:

  • Read the source code yourself, modify it and submit a pull request
  • Fork the code and maintain it yourself
  • Other people in the community help solve your problems

@fuxingZhang
Copy link
Contributor

fuxingZhang commented Nov 5, 2024

Landed on v0.4.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants