Skip to content

0.2.x: error saving binary data. #103

@bartvanhoutte

Description

@bartvanhoutte

I'm having some issues saving binary data with the child process adapter in the 0.2.x branch.

Upon calling json_encode to pipe the contents of the file from the parent process to the child process the following error occurs:

Malformed UTF-8 characters, possibly incorrectly encoded

Would it be an idea to encode the contents of the file to Base64 first and decode it in the child process?

Something like this:

\React\Filesystem\ChildProcess\File::putContents

$contents = base64_encode($contents);
return childProcessPromiseClosure(Loop::get(), function () use ($path, $contents, $flags): array {
    return ['size_written' => file_put_contents($path, base64_decode($contents), $flags)];
})->then(static fn (array $data) => (int)$data['size_written']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions