npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rbxcloud

v1.2.0

Published

A module to help with Roblox Open Cloud endpoints.

Downloads

15

Readme

About

RbxCloud is an open cloud API for Roblox experiences.

  • Object oriented
  • Aims to be as close to the Roblox API as possible for the following services:
    • DataStoreService
    • MessagingService
  • Promise-based
  • Support for non-JSON responses and such
  • Support for nearly all open-cloud features
    • Place publishing will come in a later update.

Installation

npm install rbxcloud

Example Usage

You can find working examples in example/general-usage.js or just read below:

Publish a message using MessagingService:

const { OpenCloud, MessagingService } = require('rbxcloud');
OpenCloud.Configure({
    MessagingService: 'API-KEY', // This is an API key for MessagingService
    UniverseId: 0, // You can get the UniverseId from the Asset explorer
});

MessagingService.PublishAsync('MyTopic', 'Hello World!').then(() => {
    console.log('Publish was a success!');
}).catch(err => {
    console.log(err);
});

Read, set, and update DataStore entry:

const { OpenCloud, DataStoreService } = require('rbxcloud');
const { DataStoreSetOptions } = DataStoreService.Objects;

OpenCloud.Configure({
    DataStoreService: 'API-KEY', // This is an API key for MessagingService
    UniverseId: 0, // You can get the UniverseId from the Asset explorer
});

const GoldStore = DataStoreService.GetDataStore('Gold');

GoldStore.GetAsync(125196014).then(([data, keyInfo]) => {
    console.log(keyInfo.DataType === JSON); // true / false
    console.log(keyInfo.CreatedTime); // UNIX Timestamp
    console.log(keyInfo.UpdatedTime); // UNIX Timestamp
    console.log(keyInfo.Version); // DataStore key version
    console.log(`The player has ${data.amount} gold!`)
});

// SetAsync the player's gold
GoldStore.SetAsync(125196014, {
    currency: 'Gold',
    amount: 100,
}).then((result) => {
    console.log('Data saved: ', result);
}).catch((err) => {
    console.log('Error', err);
});

// Delete the player's gold
GoldStore.RemoveAsync(125196014).then()

// Increment a player's gold (incompatible with the current data setup though)
GoldStore.IncrementAsync(125196014, 5).then(([newAmount, keyInfo]) => {
    console.log(`The player now has ${newAmount} gold!`);
}).catch((err) => {
    console.log(err);
});

// Now use UpdateAsync; has nearly the exact same functionality as the native implementation. Do not yield this.
// Additionally, if you use this with the data being an array, you will lose your data unless you wrap the array inside another array.
GoldStore.UpdateAsync(125196014, function(data, keyInfo) {
    if (data.amount < 100) {
        data += 100;
    }
    //return data; <-- This is valid
    
    // Alternatively, you can return numerous values as specified by the Roblox API for UpdateAsync:
    const metadata = {
        IsOwnedByAPlayer: true,
        IsThisPlayerVeryCool: true
    };
    return [ data, [], metadata ]
});

// UpdateAsync with an array:
GoldStore.UpdateAsync(125196014, function(data, keyInfo) {
    data.push('Hello World!');
    return [ [ data ], [], metadata ]
})

Links

Contributing

Create an issue for any suggestions or bug reports that you find. Please ensure that you've read the documentation, and if you're creating an issue, verify that it isn't a duplicate.