# img-to-base64encoded

> By this pakage you can convert your local img to base64 encoded string

Latest version **1.0.2** (published 2021-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install img-to-base64encoded
pnpm add img-to-base64encoded
yarn add img-to-base64encoded
bun add img-to-base64encoded
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-02-06 |
| First published | 2021-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bhargab Kalita |
| Maintainers | the-wrong-guy |
| Keywords | image-to-base64, base64, base64encoding |

## Links

- npm: https://www.npmjs.com/package/img-to-base64encoded
- Repository: https://github.com/the-wrong-guy/img-to-base64
- Homepage: https://github.com/the-wrong-guy/img-to-base64#readme
- Issues: https://github.com/the-wrong-guy/img-to-base64/issues
- npm.io page: https://npm.io/package/img-to-base64encoded

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-02-06
- 1.0.1 — 2021-02-06
- 1.0.0 — 2021-02-06

## README

# Img To Base64encoded

This pakage helps you to convert your local images to base64 encoded string

## Getting started

### **Installation**
---
`npm i img-to-base64encoded`

### **Using it**
---
```
<!-- This is a React Example -->

import { imgToBase64 } from "img-to-base64encoded";

export default funtion Something(){

    const handleImgChange = async(e) =>{
        <!-- you could store your image to some variable if you want to  or
        directly pass the image to the "imgToBase64" function -->

        <!-- Always use "async await" while using "imgToBase64" -->

        <!-- Storing in a variable then passing it-->
        let image = e.target.files[0];
        let base64EncodedString = await imgToBase64(image);

        <!-- Directly passing it -->
        let base64EncodedString = await imgToBase64(e.target.files[0]);
    }
    return(
        <input onChange={handleImgChange} accept="image/*" type="file" />
    )
}

```


**Demo**
---
*[Click here for Demo](https://codesandbox.io/s/objective-chaplygin-kolm2?file=/src/App.js)*

---
_Source: https://npm.io/package/img-to-base64encoded · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
