Skip to content

syscall/js: no method to convert TypedArrays into slices #30210

Closed
@superp00t

Description

@superp00t

You can convert a Go slice into a TypedArray by using js.TypedArrayOf(...), but there is apparently no way of doing the reverse operation.

You can write a function to Index() every byte value in an ArrayBuffer and put them in a byte slice, but this is cumbersome and incurs unacceptable overhead. There should be a function to directly copy the bytes into the Go heap, such as what js.Value.String() does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.arch-wasmWebAssembly issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions