We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f885728 commit 564f6a5Copy full SHA for 564f6a5
1 file changed
src/imgproxy/utils.ts
@@ -1,5 +1,6 @@
1
export const urlSafeBase64 = (value: string | Buffer) => {
2
- return Buffer.from(value).toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
+ const buffer = Buffer.isBuffer(value) ? value : Buffer.from(value);
3
+ return buffer.toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
4
};
5
6
export const hexDecode = (string: string) => Buffer.from(string, 'hex');
0 commit comments