Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access
Metacom protocol specification: https://github.com/metarhia/Contracts/blob/master/doc/Metacom.md
// Load at frontend
import { Metacom } from './metacom.js';
// Load at backend
const { Metacom } = require('metacom');
// Open connection (both platforms) and make calls
const metacom = Metacom.create('https://domainname.com:8000');
(async () => {
const { api } = metacom;
try {
await metacom.load('auth'); // Load `auth` interface
await api.auth.status(); // Check session status
} catch (err) {
await api.auth.signIn({ login: 'marcus', password: 'marcus' });
}
await metacom.load('example'); // Load `example` interface
const result = api.example.methodName({ arg1, arg2 });
})();
Create uploadFile
function on the client:
const metacom = Metacom.create('https://example.com/api');
const uploadFile = async (file) => {
// createBlobUploader creates streamId and inits file reader for convenience
const uploader = metacom.createBlobUploader(file);
// Prepare backend file consumer
await metacom.api.files.upload({
streamId: uploader.streamId,
name: file.name,
});
// Start uploading stream and wait for its end
await uploader.upload();
return { uploadedFile: file };
};
Create API method to init file destination:
// api/files/upload.js
async ({ streamId, name }) => {
const filePath = `./application/resources/${name}`;
// Get incoming stream by streamId sent from client
const readable = context.client.getStream(streamId);
// Create nodejs stream to write file on server
const writable = node.fs.createWriteStream(filePath);
// Pipe metacom readable to nodejs writable
readable.pipe(writable);
return { result: 'Stream initialized' };
};
Create downloadFile
function on the client:
const metacom = Metacom.create('https://example.com/api');
const downloadFile = async (name) => {
// Init backend file producer to get streamId
const { streamId } = await metacom.api.files.download({ name });
// Get metacom readable stream
const readable = await metacom.getStream(streamId);
// Convert stream to blob to make a file on the client
const blob = await readable.toBlob();
return new File([blob], name);
};
Create API method to init file source:
// api/files/download.js
async ({ name }) => {
const filePath = `./application/resources/${name}`;
// Create nodejs readable stream to read a file
const readable = node.fs.createReadStream(filePath);
// Get file size
const { size } = await node.fsp.stat(filePath);
// Create metacom writable stream
const writable = context.client.createStream(name, size);
// Pipe nodejs readable to metacom writable
readable.pipe(writable);
return { streamId: writable.streamId };
};
Copyright (c) 2018-2023 Metarhia contributors.
Metacom is MIT licensed.
Metacom is a part of Metarhia technology stack.
[3.0.1][] - 2023-06-22
MetacomUnit
method post
not emitting *
FAQs
Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access
The npm package metacom receives a total of 61 weekly downloads. As such, metacom popularity was classified as not popular.
We found that metacom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.