https://github.com/attestate/inline-esm-worker
A node.js worker_thread that runs once, can load modules and returns stdout
https://github.com/attestate/inline-esm-worker
Last synced: 4 months ago
JSON representation
A node.js worker_thread that runs once, can load modules and returns stdout
- Host: GitHub
- URL: https://github.com/attestate/inline-esm-worker
- Owner: attestate
- License: gpl-3.0
- Created: 2021-05-31T15:53:13.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-30T15:07:51.000Z (over 3 years ago)
- Last Synced: 2025-01-11T00:09:15.240Z (5 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# inline-esm-worker
> A node.js worker_thread Worker that runs once, can load modules and
> returns stdout## installation
```bash
$ npm i inline-esm-worker
```## usage
```js
import run from "inline-esm-worker";const script = `console.log("hello world")`;
const capturedStdout = await run(script);
> hello world
// capturedStdout is a buffer you can use for further evaluation of the script
```**notes**:
- any errors thrown within the script input of `run` are propagated to the user
and are hence catchable.## changelog
### 0.0.4
- URL encode code to prevent syntax errors
### 0.0.3
- Redirect worker's stdout to runtime of user
### 0.0.2
- `run(script)` is throwing errors that originate in running `script`.
### 0.0.1
- Initial release
## license
See LICENSE file