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
@ -54,7 +54,18 @@ export function generateOauthURL(provider: 'discord', clientID: string, scope: s
|
||||
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({
|
||||
read() {
|
||||
@ -66,5 +77,4 @@ export default function bufferToStream(binary: Buffer) {
|
||||
return readableInstanceStream
|
||||
}
|
||||
|
||||
|
||||
export { anchorHeader } from './ShowdownExtensions'
|
||||
Loading…
x
Reference in New Issue
Block a user