Socket
Book a DemoInstallSign in
Socket

@hackmesenpai/gofile-api-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackmesenpai/gofile-api-wrapper

Unofficial API Wrapper for GoFile.io for easy API Calls that uses Axios and fs module.

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
7
-12.5%
Maintainers
1
Weekly downloads
 
Created
Source

GoFile.io Unofficial API Wrapper

GoFile.io Logo

Unofficial API Wrapper for GoFile.io for easy API Calls that uses Axios and fs module.

INSTALL

npm i @hackmesenpai/gofile-api-wrapper

Functions Params (required and optional)

  • getServer() No Required Params
getServer()
  • getAccountDetails() Required Params [usertoken]
getAccountDetails([usertoken])
  • deleteContent() Required Params [contentsId, usertoken] deleteContent([contentsId, usertoken])
deleteContent([contentsId, usertoken])
  • copyContent() Required Params [contentsId, usertoken, folderIdDestination]
//This feature is only for premium/subscribed users
copyContent([contentsId, usertoken, folderIdDestination])
  • createFolder() Required Params [parentFolderID, usertoken, folderName]
createFolder([parentFolderID, usertoken, folderName])
  • getContent() Required Params [contentsId, usertoken]
//This feature is only for premium/subscribed users
getContent([contentsId, usertoken])
  • setFolderOptions() Required Params [contentsId, usertoken, folderOptions, value]
setFolderOptions([contentsId, usertoken, folderOptions, value])
  • uploadFile() Required Params [server, fileToUpload] Optional Params [usertoken, folderID]
//without usertoken and folderID
uploadFile([server, fileToUpload])

//with usertoken but no folderID creates automatically a folder with random name
uploadFile([server, fileToUpload, usertoken])

//Using Optional Params with folderID
uploadFile([server, fileToUpload, usertoken, folderID])

All Params

ParamsTypeExplanationSample
usertokenstringThe access token of an account you can get via loging in here. Can be retrieved from the profile page."PNxrcDBrUeAQNxdYLgWOafMtfxpXghM"
contentsIdstringIt can be a folderId or fileId, Comma separated contentId to delete (files or folders)"affdaa7c-134b-4397-a76f-e87970401d6d"
folderIdDestinationstringIts the destination folderId of any folder"affdaa7c-134b-4397-a76f-e87970401d6d"
folderNamestringyour folder name"Testing"
parentFolderIDstringIts the folderId of any folder"affdaa7c-134b-4397-a76f-e87970401d6d"
folderIdDestinationstringIts the folderId"affdaa7c-134b-4397-a76f-e87970401d6d"
fileToUploadstream or bufferthe file to be uploaded on the serverfs.createReadStream("testUpload.png")
folderIDstringIts the folderId"affdaa7c-134b-4397-a76f-e87970401d6d"
serverstringCan be Obtain via calling getServer()"store1"
folderIdDestinationstringIt the folderId"affdaa7c-134b-4397-a76f-e87970401d6d"
folderOptionsstringCan be "public", "password", "description", "expire" or "tags""public"
valuestringThe value of the option to be defined. For "public", can be "true" or "false". For "password", must be the password. For "description", must be the description. For "expire", must be the expiration date in the form of unix timestamp. For "tags", must be a comma seperated list of tags."true, yes or on" and "false, no or off"

FOR MORE INFO ABOUT API

Visit https://gofile.io/api

USAGES

Use require to Import

//for all functions to call
const { getAcountDetails, deleteContent, copyContent, createFolder, getContent, getServer, uploadFile, setFolderOptions } = require('@hackmesenpai/gofile-api-wrapper');

//but for example if you only want uploadFile
const { uploadFile } = require('@hackmesenpai/gofile-api-wrapper');

API Wrapper Functions

getServer()

Get the best server to recieve incoming files.

//Required to chain this using then() or define as a variable and using await to call when uploading file.
//Using then()
getServer().then((res)=>{
 console.log(res)
})

//Using Await
let res = await getServer()
console.log(res)

uploadFile()

Upload one file on a specific server.

//Required to use getServer() and chain this using then() or define as a variable and using await to call when uploading file.
//Using then()
let {data} = await getServer()
let server = data.server
let fileToUpload = fs.createReadStream("testUpload.png")

uploadFile(server, fileToUpload).then((res)=>{
 console.log(res)
})

//Using Await
let res = await uploadFile(server, fileToUpload)
console.log(res)

getAccountDetails()

Retrieving specific account information.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";

getAccountDetails(usertoken).then((res)=>{
 console.log(res)
})

//Using Await
let res = await getAccountDetails(usertoken)
console.log(res)

deleteContent()

Delete one or multiple files/folders.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";
let contentsId = "affdaa7c-134b-4397-a76f-e87970401d6d";

deleteContent(contentsId, usertoken).then((res)=>{
 console.log(res)
})

//Using Await
let res = await deleteContent(contentsId, usertoken)
console.log(res)

copyContent()

Available only for Premium/Subscribed Users. Copy one or multiple contents to another folder.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";
let contentsId = "affdaa7c-134b-4397-a76f-e87970401d6d";
let folderIdDestination = "Ifgaj4c-76h9-3680-x341-e50631705d6d";

copyContent(contentsId, usertoken, folderIdDestination).then((res)=>{
 console.log(res)
})

//Using Await
let res = await copyContent(contentsId, usertoken, folderIdDestination)
console.log(res)

createFolder()

Creates a new folder.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";
let parentFolderID = "affdaa7c-134b-4397-a76f-e87970401d6d";
let folderName = "My Folder";

createFolder(parentFolderID, usertoken, folderName).then((res)=>{
 console.log(res)
})

//Using Await
let res = await createFolder(parentFolderID, usertoken, folderName)
console.log(res)

getContent()

Available only for Premium/Subscribed Users. Get a specific content details.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";
let contentsId = "affdaa7c-134b-4397-a76f-e87970401d6d";

getContent(contentsId, usertoken).then((res)=>{
 console.log(res)
})

//Using Await
let res = await getContent(contentsId, usertoken)
console.log(res)

setFolderOptions()

Get a specific content details.

//Using then()
let usertoken = "PNxrcDBrUeAQNxdYLgWOafMtfxpXghM";
let contentsId = "affdaa7c-134b-4397-a76f-e87970401d6d";
let folderOptions = "public"; 
let value = "yes";

setFolderOptions(contentsId, usertoken, folderOptions, value).then((res)=>{
 console.log(res)
})

//Using Await
let res = await setFolderOptions(contentsId, usertoken, folderOptions, value)
console.log(res)

Keywords

gofile

FAQs

Package last updated on 29 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts