# encode(str) ⇒ string
base64.encode base64编码,用来接口传输
Returns: string
-
返回编码后的结果
Author: liukun 919590347@qq.com
Param | Type | Description |
---|---|---|
str | string | 要编码的字符串 |
Example
import { base64 } from '@wont/utils'
const query = '(ip.port="443") && country=="中国"'
base64.encode(query) // returns KGlwLnBvcnQ9IjQ0MyIpICYmIGNvdW50cnk9PSLkuK3lm70i
# encodeURI(str) ⇒ string
base64.encodeURI base64编码为url safe的字符串,用来作为URL参数跳转
Returns: string
-
返回编码后的结果
Author: liukun 919590347@qq.com
Param | Type | Description |
---|---|---|
str | string | 要编码为url safe的字符串 |
Example
import { base64 } from '@wont/utils'
const query = '(ip.port="443") && country=="中国"'
base64.encodeURI(query) // url safe returns KGlwLnBvcnQ9IjQ0MyIpICYmIGNvdW50cnk9PSLkuK3lm70i
# decode(str) ⇒ string
base64.decode base64解码,能解码base64.encode和base64.encodeURI
Returns: string
-
返回编码后的结果
Author: liukun 919590347@qq.com
Param | Type | Description |
---|---|---|
str | string | 要解码的字符串 |
Example
import { base64 } from '@wont/utils'
const query = '(ip.port="443") && country=="中国"'
base64.encode(query) // returns KGlwLnBvcnQ9IjQ0MyIpICYmIGNvdW50cnk9PSLkuK3lm70i
base64.encodeURI(query) // url safe returns KGlwLnBvcnQ9IjQ0MyIpICYmIGNvdW50cnk9PSLkuK3lm70i
base64.decode(KGlwLnBvcnQ9IjQ0MyIpICYmIGNvdW50cnk9PSLkuK3lm70i) // '(ip.port="443") && country=="中国"'
← arrayToObject compose →