elsaland / elsa

❄️ Elsa is a minimal runtime for JavaScript and TypeScript written in Go
MIT License
2.8k stars 62 forks source link

Implement filesystem ops #17

Closed littledivy closed 4 years ago

littledivy commented 4 years ago

The goal right now is to implement all the file system APIs provided by Deno - https://github.com/denoland/deno/blob/master/cli/ops/fs.rs

There is already a Elsa.readFile binding in core/dispatch.go with it's corresponding js call at js/01_namespace.js.

Looking forward to recieve PRs :smile:

tooolbox commented 4 years ago

Do you have a full list of all APIs that need to be implemented to achieve parity?

HTTP client, HTTP server, FS, these are all good examples, which I suppose will all wrap the Go stdlib?

Anyway, perhaps the list is just the Node stdlib but I'm curious what your thoughts are.

littledivy commented 4 years ago

I think we'll want to implement all the most commonly used APIs first and then think about if we'd want to expand more (this will be a seperate discussion as to how minimal we want to be)

for ref: https://doc.deno.land/builtin/stable

notfilippo commented 4 years ago

Sure, maybe add some utility methods to read directly utf-8 files since they are the most common

littledivy commented 4 years ago

We're using Afero in #25 Another interesting (and unique) API to offer would be memory based fs - https://github.com/spf13/afero#memmapfs

littledivy commented 4 years ago

All of the above listed APIs have been added :+1: