Platform
ceramic.Platform (Class)
A class that encapsulate platform-specific code.
We usually want platform-specific code to be located in a backend,
but it may happen that sometimes creating a backend interface is overkill.
That's where this comes handy.
Platform provides utilities for:
- Reading assets synchronously from disk
- Getting platform-specific paths and environment variables
- Running external commands (including the Ceramic CLI)
- Electron-specific functionality on web builds
- Platform detection (e.g., isWindows())
- Application lifecycle (quit)
- RTTI access utilities
Most platform-specific code should be in backends, but this class
is useful for simple platform-specific operations that don't warrant
a full backend interface.
See: Backend
Static Members
Read a string from an asset file, synchronously.
Warning: not available on every targets
Returns |
Description |
String |
String |
Read bytes from an asset file, synchronously.
Warning: not available on every targets
Returns assets paths on disk (if any)
Warning: not available on every targets
Returns |
Description |
String |
String |
Name |
Type |
c |
Class<getRtti.T> |
Executes the given Ceramic command asynchronously.
This will work only on desktop platforms that have a valid Ceramic installation available.
When the app has been launched by Ceramic itself, the same CLI tool will be used.
Otherwise, it will look for a ceramic
command available in PATH
Name |
Type |
Description |
args |
Array<String> |
(optional) The command arguments, which will be automatically escaped |
callback |
Function |
The callback, called when the command has finished (or failed) |
Executes the given command asynchronously
Name |
Type |
Default |
Description |
cmd |
String |
|
The command to run |
args |
Array<String> |
(optional) |
(optional) The command arguments, which will be automatically escaped |
callback |
Function |
|
The callback, called when the command has finished |
Private Members