Skip to content

Convert image to buffer chunks - react native #8

@fatima027

Description

@fatima027

I need to generate buffer of a chunk from an image path in react. Buffer format server is expecting is as follows:

<Buffer 64 61 74 61 3a 69 6d 61 67 65 2f 6a 70 65 67 3b 62 61 73 65 36 34 2c 2f 39 6a 2f 34 41 41 51 53 6b 5a 4a 52 67 41 42 41 51 45 41 53 41 42 49 41 41 44 ... 67141 more bytes>

But when trying to create Buffer in react native I am not getting similar Buffer format.

My codebase is

import { Buffer } from '@craftzdog/react-native-buffer';

  const data = await RNFS.read(filePath, length, uploadedSize, 'base64');
  const bufferData = Buffer.from(data, 'base64');

The format I am receiving from Buffer.from is

{ type: 'Buffer',
      data:
       [ 133,
         175,
         138,
         234,
         181,
         30,
         135,
         159,
         208,
         70,
         186,
         203,
         79,
         42,
         160,
         ... 39581 more items ] } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions