[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

BREAKING(io): deprecate io top level module #3556

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

lino-levan
Copy link
Contributor

Closes #3552.

@lino-levan lino-levan requested a review from kt3k as a code owner August 21, 2023 22:01
@github-actions github-actions bot added the io label Aug 21, 2023
Copy link
Member
@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@kt3k
Copy link
Member
kt3k commented Aug 22, 2023

I'll let this open for a while to see if there's any concern/objection to this

@iuioiua
Copy link
Contributor
iuioiua commented Aug 24, 2023

The yaml, archive, log and streams modules depend on this module. I think it's important that this PR includes moving these modules using web streams instead of io. It'll also validate the deprecation itself.

@kt3k
Copy link
Member
kt3k commented Sep 20, 2023

I think io is now ready to be deprecated

@kt3k kt3k merged commit b62f528 into denoland:main Sep 20, 2023
@KaKi87
Copy link
KaKi87 commented Feb 3, 2024

Hello,
The MDN link doesn't say concretely what to replace readLines() with for reading a file line by line like in the following code :

const file = await Deno.open(filePath, { read: true });
for await (const line of readLines(file)){
    console.log(line);
}
await file.close();

Help ?
Thanks

@kt3k
Copy link
Member
kt3k commented Feb 3, 2024

You should use file.readable, TextDecoderStream, and TextLineStream to read lines from a file.

import { TextLineStream } from "https://deno.land/std@0.214.0/streams/mod.ts";
const file = await Deno.open(filePath, { read: true });
const lines = file.readable
  .pipeThrough(new TextDecoderStream())
  .pipeThrough(new TextLineStream());
for await (const line of lines) {
  console.log(line);
}

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

Successfully merging this pull request may close these issues.

Deprecate io module
4 participants