https://github.com/meepobrother/meepo-base64
base64加密
https://github.com/meepobrother/meepo-base64
angular base64 service
Last synced: about 1 month ago
JSON representation
base64加密
- Host: GitHub
- URL: https://github.com/meepobrother/meepo-base64
- Owner: meepobrother
- License: mit
- Created: 2017-12-22T00:35:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-03T09:16:41.000Z (over 8 years ago)
- Last Synced: 2025-01-10T22:46:34.015Z (over 1 year ago)
- Topics: angular, base64, service
- Language: JavaScript
- Homepage: https://meepo.com.cn
- Size: 372 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [js-base64](https://github.com/dankogai/js-base64)
- 安装
```sh
yarn add meepo-base64
```
- 引入
```ts
import { Base64Module } from '../../src/app/app';
@NgModule({
imports: [
Base64Module.forRoot()
]
})
export class AppModule { }
```
- 使用
```ts
import { Base64Service } from 'meepo-base64';
export class AppComponent {
result: string = '';
source: string = '';
constructor(
public base64: Base64Service
) { }
encode() {
this.result = this.base64.encode(this.source);
}
decode() {
this.result = this.base64.decode(this.source);
}
encodeURI() {
this.result = this.base64.encodeURI(this.source);
}
atob() {
this.result = this.base64.atob(this.source);
}
btoa() {
this.result = this.base64.btoa(this.source);
}
fromBase64() {
this.result = this.base64.fromBase64(this.source);
}
toBase64() {
this.result = this.base64.toBase64(this.source);
}
btou() {
this.result = this.base64.btou(this.source);
}
utob() {
this.result = this.base64.utob(this.source);
}
}
```