1.0.6 • Published 5 years ago

image-to-file-converter v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

image-to-file-converter

Install

$ npm install image-to-file-converter

Usage

画像パスからFileオブジェクト

import { pathToFile } from 'image-to-file-converter'

pathToFile('./path/to/image.jpg').then((res)=>{
      console.info(res)  // File
})  

Functions

base64ToFile

base64ToFile(src: string,  resize?: number, name?: string): Promise<File>
  • src:string | 元画像のbase64
  • name?: string | 拡張子付きのファイル名
  • resize?: number | 縮小後の長辺の長さ nullまたは0以下の時は原寸

pathToFile

pathToFile(src: string,  resize?: number): Promise<File>

DEMO

https://tkpea.github.io/image-to-file-converter/example/dist/

Example

$ git clone https://github.com/tkpea/image-to-file-converter.git
$ cd ./example/image-to-file-converter
$ npm install
$ npm run start

TIPS

FileオブジェクトのダウンロードURLを生成する

let url = window.URL.createObjectURL(File);

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago