Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tcl

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcl

Node.js Tcl binding

  • 2.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-54.55%
Maintainers
1
Weekly downloads
 
Created
Source

node-tcl

npm version Build Status Coverage Status Dependency Status devDependency Status

Node.js Tcl bindings to execute Tcl commands using a native Tcl Interpreter.

Dependencies

  • Tcl development files (e.g. sudo apt-get install tcl-dev or sudo yum install tcl-devel)

The build process will look for tclConfig.sh to identify Tcl include directory and linker flags. If you are using a Tcl version older than 8.5 or want to link to a specific Tcl installation use the TCLCONFIG environment variable to override the default behaviour (e.g. export TCLCONFIG=/path/to/tclConfig.sh).

Optional Dependencies

  • Tcl thread support (To enable async commands outside the main event loop)
  • C++ compiler with support for c++11 features (To enable async command queues outside the main event loop)

Installation

$ npm install --save tcl

Usage

var tcl = require( 'tcl' );
var Tcl = require( 'tcl' ).Tcl;
var tcl = new Tcl();

$( cmd ), cmdSync( cmd ), evalSync( cmd )

Execute a Tcl command synchronously and returns a Result.

Parameters
NameTypeDescription
cmdStringCommand to execute
Example
tcl.$( 'info version' );

$.(tcl-command)( ... )

Execute a Tcl command using injected helper methods and returns a Result.

Example
tcl.$.info( 'tclversion' );
tcl.$.set( 'x', 10 );
tcl.$.expr( 22, '/', '7.0' );

load( module )

Load a Tcl module and refresh injected helper methods.

Example
tcl.load( 'libfoo.so' );
tcl.$.foo();

source( file )

Source a Tcl script file and refresh injected helper methods.

Example
tcl.source( '/path/to/multiply.tcl' );
tcl.$.multiply( 2, 3 );

cmd( cmd, callback ), eval( cmd, callback )

Execute a Tcl command asynchronously using a new worker thread (A new Tcl interpreter instance will be created for each call).

Parameters
NameTypeDescription
cmdStringCommand to execute
callbackCallbackCallback method to handle the response
Example
tcl.cmd( 'info tclversion', function ( err, result ) {
	if ( err ) {
		return console.log( err );
	}

	console.log( result.data() );
} );

tcl.eval( 'info commands', function ( err, result ) {
	if ( err ) {
		return console.log( err );
	}

	console.log( result.toArray() );
} );

queue( cmd, callback )

Execute a Tcl command asynchronously using a shared worker thread. A new Tcl interpreter instance will be created for the worker thread but will be shared between calls.

Parameters
NameTypeDescription
cmdStringCommand to execute
callbackCallbackCallback method to handle the response
Example
tcl.queue( 'set x 1' );
tcl.queue( 'incr x', function ( err, result ) {
	if ( err ) {
		return console.log( err );
	}

	console.log( result.data() ); // 2
} );

API Documentation

JSDoc generated API documentation can be found at http://nukedzn.github.io/node-tcl/docs/.

Contributing

Contributions are welcome through GitHub pull requests (using fork & pull model).

Keywords

FAQs

Package last updated on 31 Oct 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc