Closed jgrigg closed 4 years ago
@gcanti are you happy to merge this in or shall i close it?
i don't think its a breaking change
@jgrigg I'm not sure about this, looks like the Buffer
type comes from the @types/node
package which is not listed in peerDependencies
.
I would only add codecs which work in both context (browser and node).
@DenisFrezzato WDYT?
@gcanti that's right, adding a dependency would be a breaking change, I didn't realise that. On the other hand, it would be bad to throw away this work. Maybe it makes sense to create another repository for node
types. We can also consider to make this a multi-package repository with packages like common
, node
and browser
(and re-export types from common
in order to be retro compatible).
Yeah fair enough. Happy to re-open this PR against either of @DenisFrezzato suggestions should you decide to go down that route. Interestingly deno doesn't have an equivalent of Node's Buffer
I think the closest is probably Uint8Array
which can be paired with TextEncoder
/TextDecoder
. An io-ts
codec for this could be something that goes into a common
package since they are Web APIs.
Codec for decoding a base64 string into a NodeJS Buffer. Obviously this won't work when used in a browser context but i don't think its a breaking change as i wouldn't expect such a project to use it.