Summary
The current types accepted by e.g. esm/sync.d.ts::parse() are Buffer | string. But there's no way to access the Buffer class as it is not exported.
Motivation
I have a Uint8Array that I would like to pass in. Given that the built-in Buffer class is an overlay on top of Uint8Array, seems like that should be easy to hook up.
Alternative
I've been implementing this by importing a different Buffer implementation which apparently is close enough to fool the typescript types and the internal processing of csv-parse to work out. This is not ideal.
Draft
Change esm/sync.js::parse() and related APIs to explicitly allow a Uint8Array to be passed in, and wrap it in the local Buffer type directly (or copy it to a fresh one if that's preferable). Perhaps it makes sense to include other TypedArray types as well.
Summary
The current types accepted by e.g.
esm/sync.d.ts::parse()areBuffer | string. But there's no way to access theBufferclass as it is not exported.Motivation
I have a
Uint8Arraythat I would like to pass in. Given that the built-inBufferclass is an overlay on top ofUint8Array, seems like that should be easy to hook up.Alternative
I've been implementing this by importing a different
Bufferimplementation which apparently is close enough to fool the typescript types and the internal processing of csv-parse to work out. This is not ideal.Draft
Change
esm/sync.js::parse()and related APIs to explicitly allow aUint8Arrayto be passed in, and wrap it in the localBuffertype directly (or copy it to a fresh one if that's preferable). Perhaps it makes sense to include other TypedArray types as well.