go-reader

module
v0.0.0-...-b2ee3fb Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: MIT

README

Build Status Go Report Card GoDoc license

go-reader

Description

go-reader is a simple library for managing the reading of uncompressed text from underlying resources.

Using cross compilers, this library can also be called by other languages. This library is cross compiled into a Shared Object file (*.so). The Shared Object file can be called by C, C++, and Python on Linux machines. See the examples folder for patterns that you can use. This library is also compiled to pure JavaScript using GopherJS.

Usage

CLI

You can use the command line tool to convert between formats.

Usage: reader -uri URI [-alg [bzip2|gzip|snappy|none]] [-verbose] [-version]
Options:
  -alg string
    	Stream input compression algorithm for nodes, using: bzip2, gzip, snappy, or none. (default "none")
  -aws_access_key_id string
    	Defaults to value of environment variable AWS_ACCESS_KEY_ID
  -aws_default_region string
    	Defaults to value of environment variable AWS_DEFAULT_REGION.
  -aws_secret_access_key string
    	Defaults to value of environment variable AWS_SECRET_ACCESS_KEY.
  -aws_session_token string
    	Defaults to value of environment variable AWS_SESSION_TOKEN.
  -buffer_size int
    	The input reader buffer size (default 4096)
  -hdfs_name_node string
    	Defaults to value of environment variable HDFS_DEFAULT_NAME_NODE.
  -help
    	Print help
  -uri string
    	"stdin" or uri to input file
  -version
    	Prints version to stdout

Go

You can import go-reader as a library with:

import (
  "github.com/spatialcurrent/go-reader/reader"
)
...

See reader in GoDoc for information on how to use Go API.

JavaScript

<html>
  <head>
    <script src="https://...reader.js"></script>
  </head>
  <body>
    <script>
      reader.open(uri, "none", function(text){ ... })
      ...
    </script>
  </body>
</html>

Examples:

TBD

Building

CLI

The command line go-reader program can be built with the scripts/build_cli.sh script.

JavaScript

You can compile go-reader to pure JavaScript with the scripts/build_javascript.sh script.

Shared Object

The scripts/build_so.sh script is used to build a Shared Object (*.go), which can be called by C, C++, and Python on Linux machines.

Changing Destination

The default destination for build artifacts is go-reader/bin, but you can change the destination with a CLI argument. For building on a Chromebook consider saving the artifacts in /usr/local/go/bin, e.g., bash scripts/build_cli.sh /usr/local/go/bin

Contributing

Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.md for how to get started.

License

This work is distributed under the MIT License. See LICENSE file.

Directories

Path Synopsis
cmd
reader.js
reader.js is the Javascript version of go-reader.
reader.js is the Javascript version of go-reader.
plugins
Package reader provides the interfaces, embedded structs, and implementing code for normalizing the reading a stream of bytes from compressed files.
Package reader provides the interfaces, embedded structs, and implementing code for normalizing the reading a stream of bytes from compressed files.

Jump to

Keyboard shortcuts

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