mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
feat: added form data function
This commit is contained in:
parent
c8ae254c33
commit
19a6bd8826
@ -33,7 +33,7 @@ export function supportsWebP() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkBrowser(){
|
export function checkBrowser() {
|
||||||
const ua = navigator.userAgent
|
const ua = navigator.userAgent
|
||||||
let tem
|
let tem
|
||||||
let M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+(\.\d+)?(\.\d+)?)/i) || []
|
let M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+(\.\d+)?(\.\d+)?)/i) || []
|
||||||
@ -54,7 +54,18 @@ export function generateOauthURL(provider: 'discord', clientID: string, scope: s
|
|||||||
return Oauth[provider](clientID, scope)
|
return Oauth[provider](clientID, scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function bufferToStream(binary: Buffer) {
|
export function formData(details: { [key: string]: string | number | boolean }) {
|
||||||
|
const formBody = []
|
||||||
|
for (const property in details) {
|
||||||
|
const encodedKey = encodeURIComponent(property)
|
||||||
|
const encodedValue = encodeURIComponent(details[property])
|
||||||
|
formBody.push(encodedKey + '=' + encodedValue)
|
||||||
|
}
|
||||||
|
return formBody.join('&')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function bufferToStream(binary: Buffer) {
|
||||||
|
|
||||||
const readableInstanceStream = new Readable({
|
const readableInstanceStream = new Readable({
|
||||||
read() {
|
read() {
|
||||||
@ -66,5 +77,4 @@ export default function bufferToStream(binary: Buffer) {
|
|||||||
return readableInstanceStream
|
return readableInstanceStream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export { anchorHeader } from './ShowdownExtensions'
|
export { anchorHeader } from './ShowdownExtensions'
|
||||||
Loading…
x
Reference in New Issue
Block a user