← 输入框|github.com|刷新
Skip to content

toArrayBuffer #22

Closed
Closed

Description

@matthewleon

There should probably be a way to convert these to ArrayBuffer. It's pretty simple to do: https://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer

The question it raises is whether that would mean 1) exporting the ArrayBuffer type from this package, 2) adding a dependency to purescript-arraybuffer-types, or 3) moving this functionality somewhere else (or does it exist somewhere else already?)

My feeling is that option 2) makes some sense, though it's breaking.

Activity

  1. matthewleon commented on Nov 5, 2017

    @matthewleon
    ContributorAuthor

    On further thought, perhaps the smartest way is to add the dependency and export toUint8Array, defined simply as an unsafeCoerce.

  2. matthewleon commented on Nov 6, 2017

    @matthewleon
    ContributorAuthor

    On third thought, using unsafeCoerce to get a Uint8Array is unwise because of a couple of subtle differences between the two types, as explained here: https://nodejs.org/docs/latest/api/buffer.html#buffer_buffers_and_typedarray

    The initial ArrayBuffer idea should work though.

  3. added a commit that references this issue on Nov 7, 2017
    8852bd5
  4. added a commit that references this issue on Nov 19, 2017
    9298bf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions