Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

flaschenode

0.0.7 • Public • Published

Node Flaschen Taschen thing

Trying to make a simple thing for people to send stuff to the big light thing at Noisebridge.

see: https://github.com/hzeller/flaschen-taschen

and come see it and interact in person.

Elephant image from https://pixabay.com/en/three-d-3d-abstract-art-elephant-1781590/

Usage:

For some examples of how to use this module look in the tests directory, I think the tests/singular.js file should even run if you don't have imagemagick installed already.

But i don't think npm will let you install the package without imagemagick so make sure you have that installed.

So you can:

npm install flaschenode

And if there are no errors you should be ready to start interacting with the flaschen-taschen.

Basically it gives you an object and you create a datagram as a Buffer as the data attribute and then send it to the flaschen-taschen.

To see if everything works you should just to install this and then run copy one of the example scripts into your directory and hack on it.

So to just send a simple image:

 
var flaschen = require('flaschenode');
var imagemagick = require('imagemagick-native');
var fs = require('fs')
var file = "./node_modules/flaschenode/elephant.jpeg"
 
//flaschen.hostname = 'localhost';
// layers go from 1-15 so uncomment the following and you'll be on top
//flaschen.layer = 15;
 
const footer = new Buffer(flaschen.footerString())
 
var srcData = fs.readFileSync(file);
 
var content = imagemagick.convert({
  srcData: srcData,
  width: 45,
  height: 35,
  format: 'ppm'
})
 
var totlen = footer.length + content.length;
 
var allcon = Buffer.concat([content, footer], totlen)
 
flaschen.data = allcon;
 
// Send the data to the flaschen-taschen
flaschen.show()
 

Install

npm i flaschenode

DownloadsWeekly Downloads

8

Version

0.0.7

License

ISC

Unpacked Size

3.97 MB

Total Files

92

Last publish

Collaborators

  • avatar