1.1.5 • Published 2 years ago

github-image-uploader v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

Upload base64 image to github by token compatible with nodejs and browser environment.

Install

with npm

npm i github-image-uploader

with cdn

<script src="https://cdn.jsdelivr.net/npm/github-image-uploader@1.1.5/dist/index.min.js"></script>

Usage

const { GhImgUploader } = require("github-image-uploader");

const uploader = new GhImgUploader(options: IOptions);
uploader.upload(uploadOptions: IUploadOptions);

IOptions

export type IOptions = {
  token: string;
  owner: string;
  repos: string;
  dir?: string;
  branch?: string;
};
KeyTypeDefaultDescription
tokenstringrequired, github token
ownerstringrequired, github username
reposstringrequired, github repos name
dirstringoptional, upload directory, empty string means root dir. eg: sub/
branchstringmasteroptional, upload branch, by default is master branch

IUploadOptions

export type IUploadOptions = {
  base64Img: string;
  filename: string;
  filenameHandler?: "hash" | "date" | ((filename: string) => string);
};
KeyTypeDefaultDescription
base64Imgstringrequired
filenamestringrequired, eg: x.jpg
filenameHandlerstring, functionoptional, "hash" or "date" will call inner built handler, you can pass custom handler by pass a function
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago