otdata

package module
v0.0.0-...-8699207 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 14 Imported by: 0

README

ot-datafile

external script communication for onetap.com.

How does this work?

this very simply watches for the specified datafile to be altered and decodes the hex format, matches against all JSON objects then iterates through them to build a complete base64 string which holds your data, this is then decoded into JSON and sent over the Reader channel.

Usage

require the javascript file (datafileex.js) in your own script, save your data you want to communicate to a datafile using the save function and then add a hook to that datafile in your go application so that the data is continuously "streamed" over the Reader channel.

Example

https://github.com/d-ank/sm-server

Why golang?

no reason, just what was installed on my machine and i think its easy to understand whats going on for someone to pretty easily be able to implement it in another language.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(str []byte) (json.RawMessage, error)

Parse outputs a json string from the onetap datafile format, so long as the data values are also a json

Types

type Hook

type Hook struct {
	Name   string
	Reader chan json.RawMessage
	// contains filtered or unexported fields
}

Hook is a hooked onetap datafile

func Add

func Add(datafile string) (*Hook, error)

Add takes in a datafile in the ot/scripts subfolder and returns a Hook

func (*Hook) Close

func (hook *Hook) Close()

Close the hook on the datafile

func (*Hook) Write

func (hook *Hook) Write(json json.RawMessage) error

Write handles writing to a datafile, it is structurally the same as with the javascript library however it cant write to the out segment, instead it writes to the in segment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL