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

add deno example with import 'npm:@msgpack/msgpack' #232

Closed
benatkin opened this issue Aug 8, 2023 · 1 comment · Fixed by #233
Closed

add deno example with import 'npm:@msgpack/msgpack' #232

benatkin opened this issue Aug 8, 2023 · 1 comment · Fixed by #233

Comments

@benatkin
Copy link

benatkin commented Aug 8, 2023

This works for me in Deno:

import * as msgpack from 'npm:@msgpack/msgpack'
msgpack.decode(msgpack.encode(['MessagePack', 'rocks!']))

This is my preferred way to use it with Deno. I am wondering if it could be considered the standard way of using @msgpack/msgpack from Deno. If so, perhaps this could be given an example with just deno.js and the other ones could have longer names. Also the only thing that changes in the other examples is the URL. Perhaps it could just be comments in deno.js:

#!/usr/bin/env deno run
/* eslint-disable no-console */
import * as msgpack from 'npm:@msgpack/msgpack';

// from UNPKG
//import * as msgpack from "https://unpkg.com/@msgpack/msgpack/mod.ts";

// from esm.sh
//import * as msgpack from "https://esm.sh/@msgpack/msgpack/mod.ts";

// from jsDelivr
//import * as msgpack from "https://cdn.jsdelivr.net/npm/@msgpack/msgpack/mod.ts";

console.log(msgpack.decode(msgpack.encode("Hello, world!")));
@gfx
Copy link
Member

gfx commented Aug 8, 2023

Hi. I didn't know deno can do it and seemed better than others. Added it in #233.

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

Successfully merging a pull request may close this issue.

2 participants