-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
I tried using this on a frontend with vite and I'm running into Buffer undefined errors...
Am I correct to assume this is hard coded to use Node exclusive API's and cannot run on the web?
Reproduction: https://stackblitz.com/edit/vitejs-vite-dd5uyzfe?file=src%2Funserialize.ts&terminal=dev
Code:
import { unserialize } from 'php-serialize'
export function setupSerializer(
input: HTMLTextAreaElement,
output: HTMLTextAreaElement,
button: HTMLButtonElement
) {
const setCounter = (text: string) => {
output.value = 'converting...'
try {
output.value = unserialize(text)
} catch (e) {
output.value = (e as any).message
console.error(e)
}
}
button.addEventListener('click', () => setCounter(input.value))
input.value = 'a:1:{s:4:"Test";s:15:"serialize here!";}'
output.value = 'Click button below to convert serialized PHP Array to JSON'
setCounter(input.value)
}
Result:
Metadata
Metadata
Assignees
Labels
No labels
