Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 03:31
    kitsonk edited #3421
  • 03:23
    kitsonk commented #2475
  • 03:06
    nayeemrmn commented #3509
  • 02:50
    kitsonk commented #3506
  • 02:31
    kitsonk synchronize #3421
  • Dec 15 22:16
    ry commented #3506
  • Dec 15 20:21
    nayeemrmn synchronize #3509
  • Dec 15 19:26
    nayeemrmn synchronize #3509
  • Dec 15 19:22
    kevinkassimo commented #3508
  • Dec 15 19:12
    kevinkassimo commented #3508
  • Dec 15 19:09
    nayeemrmn opened #3509
  • Dec 15 19:08
    kevinkassimo commented #3508
  • Dec 15 19:07
    kevinkassimo commented #3508
  • Dec 15 19:07
    kevinkassimo commented #3508
  • Dec 15 18:59
    kitsonk synchronize #3421
  • Dec 15 18:44
    sholladay commented #2475
  • Dec 15 18:29
    kevinkassimo synchronize #3503
  • Dec 15 18:08
    axetroy edited #3508
  • Dec 15 18:08
    axetroy edited #3508
  • Dec 15 18:07
    axetroy edited #3508
迷渡
@justjavac
thx
图片.png
迷渡
@justjavac
in Shenzhen China
Kermit Xuan
@Kermit-Xuan
🎉
Kevin (Kun) "Kassimo" Qian
@kevinkassimo
Oh whoa, did not know that!
迷渡
@justjavac
me too
Dec 20th, I will go to Shenzhen GMTC, to talk Deno.
Kermit Xuan
@Kermit-Xuan
I want to go, but I missed the best time to buy a ticket😫
迷渡
@justjavac
😭
木杉
@zhmushan
Where can I see more information about this
Patrik Jajcay
@iFarmGolems
Hey, how to convert Uint8Array to text ?
木杉
@zhmushan
@iFarmGolems new TextDecoder().decode
Patrik Jajcay
@iFarmGolems
@zhmushan Thanks :)
Im not used to buffers yet
Patrik Jajcay
@iFarmGolems

Any idea why passing [ "code", "-r", "C:/Users/patrikj/scripts/changedFiles.deno", "C:/Users/patrikj/scripts/test/a.xml" ] to Deno.run as args is not working?

When I try to use it directly like code -r C:/Users/xxx/scripts/changedFiles.deno C:/Users/xxx/scripts/test/a.xml it works.

When as arguments to Deno.run, it throws:

?[1;31merror: ?[0mUncaught NotFound: The system cannot find the file specified. (os error 2)
► ?[38;5;14m$deno$/dispatch_json.ts?[0m:?[38;5;11m40?[0m:?[38;5;11m11?[0m
    at ?[1;3mDenoError?[0m (?[38;5;14m$deno$/errors.ts?[0m:?[38;5;11m20?[0m:?[38;5;11m5?[0m)
    at ?[1;3munwrapResponse?[0m (?[38;5;14m$deno$/dispatch_json.ts?[0m:?[38;5;11m40?[0m:?[38;5;11m11?[0m)
    at ?[1;3msendSync?[0m (?[38;5;14m$deno$/dispatch_json.ts?[0m:?[38;5;11m67?[0m:?[38;5;11m10?[0m)
    at ?[1;3mrun?[0m (?[38;5;14m$deno$/process.ts?[0m:?[38;5;11m223?[0m:?[38;5;11m15?[0m)
    at ?[1;3mmain?[0m (?[38;5;14mfile:///C:/Users/patrikj/scripts/changedFiles.deno?[0m:?[38;5;11m19?[0m:?[38;5;11m16?[0m)
Is there some escaping to do?
Rafał Pocztarski
@rsp
@iFarmGolems if you don't want to create new encoder/decoder instances every time you need them, you can use my simple https://deno.land/x/ende/ library.
Patrik Jajcay
@iFarmGolems
Figured out why it's not working - it's spawning different shell than git bash used to run it (?)
@rsp thanks
Nayeem Rahman
@nayeemrmn
@rsp We actually have that in std: https://deno.land/std/strings/mod.ts.
Esmio
@Esmio
do you guys know when deno would release v1.0
Bartek Iwańczuk
@bartlomieju

@Esmio denoland/deno#2473

Release estimate as of Oct 24, 2019: End of year

Axetroy
@axetroy

I see related API in rust std

https://doc.rust-lang.org/std/os/windows/fs/fn.symlink_file.html

use std::os::windows::fs;

fn main()-> std::io::Result <()> {
     fs::symlink_file("a.txt", "b.txt") ?;
     Ok(())
}

But when I import and use, why does it prompt that this package does not exist?

I am using rust@1.39.0 stable in MacOS

Kevin (Kun) "Kassimo" Qian
@kevinkassimo
... since it is Windows only
You might want to use cfg! macro to specify OS dependent APIs to use
Rust Windows specific libraries are not available on *nix, vice versa
David
@David-Else
I am trying to write a script that takes user input from the console, and can't seem to find any reference to this type of 'bash scripting'. Can anyone give me a link to how to do something simple like read from the command line? Cheers.
Bartek Iwańczuk
@bartlomieju
@David-Else take a look at examples in std https://github.com/denoland/deno/blob/master/std/examples/README.md
they are CLI apps so there's some simple processing
David
@David-Else
@bartlomieju Cheers, I had a look at those programs but can't seem to find any example of reading from the command line. All I want is to ask a user 'do you want to do this y/n' and store the result as a boolean, or even a string. Just like the read command in bash, do you know how to do this in deno? It seems so basic, like it would be the first example in the example programs? Cheers.
Bartek Iwańczuk
@bartlomieju
@David-Else ooops, I was mistaken, take a look at xeval
it's in separate module, there's this chunks utility, that you can use to read lines from stdin
as for reading y/n, we have something like that in installer: https://github.com/denoland/deno/blob/master/std/installer/mod.ts
sometime ago I was working on CLI utils but did not get far, I guess it makes sense to collect all such utils into std/cli module
Bartek Iwańczuk
@bartlomieju
prompting and reading lines from stdin are repeatable in almost all CLIs
David
@David-Else
@bartlomieju I am reading the code you linked, and there is a lot! Is there not something like Deno.read I can use? Thanks for helping! Things are seemingly very complex for something so simple.
Bartek Iwańczuk
@bartlomieju
@David-Else there is Deno.read but it's for low-level Reader interface where you read into Uint8Array. There are quite a few issues about reading lines from stdin but there was no real movement in that department. I might take a loot at that over the weekend to finally cross it off the todo list :sweat_smile:
David
@David-Else
@bartlomieju That sounds great! I was under the impression Deno would be able to replace bash as a kind of 'super scripting' tool. The problem is bash is really basic and the syntax is junk, but it is everywhere. I don't know python, and can't be bothered to learn it just to make simple tool scripts. Deno could really fill in a gap in the market, especially with the added security. I will watch the deno change logs eagerly! :)
David
@David-Else
@bartlomieju Maybe I am misunderstanding the situation regarding interfacing between the CLI and deno? I am no expert in this, if there are any simple examples of how to ask a user Yes or No using deno on the command line with no extras then I would be very interested. I probably don't know what I am talking about here :)
Bartek Iwańczuk
@bartlomieju
Well, yeah, your suggestions sound very reasonable and I agree that such functionality should be exposed OOTB. Anyway, it's rather short and simple so no problem to add it.
Alex J Burke
@alexjeffburke
Hi there - I’m somewhat of a quiet deno follower and was the one that ported Unexpected. Re the super shell thing, one nifty thing might be to support the -c option on the command line - I saw someone set SHELL=python in a Makefile and then write the whole thing in python :) Doesn’t work with node because -c does something else sadly
Walle Cyril
@GrosSacASac
Are there plans to add streams in Deno ? If yes, Node streams or whatwg streams ?
Nayeem Rahman
@nayeemrmn

@David-Else

import { BufReader } from "https://deno.land/std@v0.26.0/io/bufio.ts";

const stdinReader = new BufReader(Deno.stdin);
while (true) {
  console.log("yes/no:");
  const input = (await stdinReader.readString("\n") as string).trim();
  console.log(`You wrote "${input}"`);
}

Right now, the built-in ops are chosen to be an almost minimal set and any higher level "helper" stuff is put into std, usually without a second thought. What you're suggesting is a substantial change where we start putting some of that into Deno... I've agreed with that for a while.

That should follow some careful thought and deciding in advance a philosophy as to what helpers get built-in. I definitely think apps like the above should be more ergonomic.

Kitson Kelly
@kitsonk
@GrosSacASac it will be WHATWG Streams. I guess we should create an issue for that.
David
@David-Else
@nayeemrmn Thanks! Agreed, something that basic should be built in. Hope that happens before v1.0. Deno.readString() is essential, loading it as an online dependency seems strange, Deno.writeFile() exists. It is great to stay minimal, but essential features should be OOTB.
Nayeem Rahman
@nayeemrmn

@David-Else I think we should be careful about calling features like this "essential", because that's exactly what they aren't. When I said the built-in op set is "minimal" I meant precisely the essentials required to implement things like readString() in javascript without further native bindings, which we currently can.

This is what I meant by being careful about choosing what gets built-in. Why would readString() be built-in? Not because it's "essential" - it isn't. Perhaps because it's commonly used in one of many guiding examples we've chosen of things that should be ergonomically doable with the built-in APIs? That would be a better path of reasoning.

David
@David-Else

@nayeemrmn I think we are just looking at this from two different angles. I am thinking of a user perspective, and you the programmer of the application itself. As a user I just want to read yes or no from the command line without importing dependencies from the web. I do not know or care how deno works under the hood. I don't want to have to post in chat rooms to work out how to do something so simple. I would like to go into VS Code, type Deno and see all the API options, just like in the screenshot below. For readFile it is perfect, even a little example appears to show me how it works. This is a great user experience.

I have zero authority to say how you should implement this in Deno, but I am just here to tell you the user perspective in case it helps. I love Deno and want it to succeed!

deno.png
Nayeem Rahman
@nayeemrmn
I wasn't saying no, I was talking about being a bit methodical about it. Nevermind.