Socket
Socket
Sign inDemoInstall

save-engine

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    save-engine

Save engine based on Roblox save engine made in JS using JSON


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Save Engine v1.0.0

This save engine is based on "Roblox Save Engine"

createDataStore(name,jsonObj)

Creates a datastore by that name on that JSON object

saveData(DataId, dataStore, jsonObj, value)

Creates a data save ID on that Datastore and assigns a value on it

readData(DataId, dataStore, jsonObj)

Reads that ID and returns a status which has the value of the requested ID

readSave(file)

Reads that saved file and returns a code which has the jsonObj of the file.

NOTE: The "file" property is the whole file location excluding the extension, Example: "C:/Users/user/Desktop/projects/test/save" instead of "C:/Users/user/Desktop/projects/test/save.json"

writeSave(file, jsonObj)

Writes the file with that JSON Object

NOTE: The "file" property is the whole file location excluding the extension, Example: "C:/Users/user/Desktop/projects/test/save" instead of "C:/Users/user/Desktop/projects/test/save.json"

Status Codes

Success Codes:

Code 0

Used at:

createDataStore

Body:

{code: 0, details: "Datastore created"}

Description:

Datastore Created, This means there is a new Datastore on that JSON object

Code 1

Used at:

SaveData

Body:

{code: 1, details: `Data saved on ${DataId} inside the ${dataStore}

Description:

Data has been saved on that ID inside the datastore successfully

Code 2

Used at:

readData

Body:

{code: 2, details: "Value returned successfully", value: DataStore[DataId]}

Description:

Program could access and read the value of the requested ID, data is stored at "value" property

Code 3

Used at:

readSave

Body:

{code: 3, details: "File read successfully", data: require(`${file}.json`)}

Description:

File has been read and got its JSON object

Code 4

Used at:

writeSave

Body:

{code: 4, details: "File saved sucessfully"}

Description:

File has been saved!

Error Codes:

Code -1

Used at:

createDataStore

Body:

{code: -1, details: `Datastore could not be created due an error: ${err}`}

Description:

Program cannot create a Datastore, explained by "err"

Code -2

Used at:

createDataStore

Body:

{code: -2, details: "Datastore could not be created beacuse there was a datastore with that name."}

Description:

Cannot create another datastore with that name.

Code -3

Used at:

saveData readData

Body:

{code: -3, details: `Could not access that ID due an error: ${err}`}

Description:

Cannot access that ID due an error explained by "err"

Code -4

Used at:

saveData readData

Body:

{code: -4, details: "Could not access that Datastore."}

Description:

Cannot access that Datastore do an error, The most common error is Misspelling datastore name

Code -5

Used at:

readData

Body:

{code: -5, details: `Could not find an ID by that name on that Datastore.`}

Description:

Program could not find an ID by that name on the Datastore, check if the ID or the Datastore name are spelled correctly

Code -6

Used at:

readSave

Body:

{code: -6, details: `Error reading the save file: ${err}`}

Description:

Could not read the file, Explained by "err"

Code -7

Used at:

writeSave

Body:

{code: -7, details: `Could not write in the savefile due an error: ${err}`};

Description:

Could not write in the file, Explained by "err"

Keywords

FAQs

Last updated on 04 Aug 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc