Location of temporary file storage on Galaxy


#1

What is the path I need to put in my code to save a temporary file? Acording to the Docs, it is /tmp (http://galaxy-guide.meteor.com/file-storage.html). But I have tried everything I know and it fails when I try to access the file:

===ERROR===
events.js:72
Throw er; // Unhandled ‘error’ event
^
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit
===CODE===

var path = './tmp/';
var filePathPdf= path + 'myTestFile.pdf';
    var pdf = webshot(html, filePathPdf, options, function (err) {
        fs.readFile(filePathPdf, function (err, data) {
            if (err) {
                return console.log(err);
            }
           //fs.unlinkSync(fileNamePdf);
            fut.return(data);
        });
    });

    var Fiber = Npm.require('fibers');

    function sleep(ms) {
        var fiber = Fiber.current;
        setTimeout(function() {
            fiber.run();
        }, ms);
        Fiber.yield();
    }
 // wait for pdf before sending email (cap loop at 5 seconds for testing)
    Fiber(function() {
        var w = 0;
        do {
            sleep(1000);
            w++;
//this is where it fails----------------------
            test = fs.existsSync(filePathPdf);
            console.log(test);
            console.log(w);
        }
        while ((test != true) || (w > 5));

it is clear that “var path = ‘./tmp/’;” is wrong… but I don’t know what it should be…
The code works great on my development server.

Help please and thanks.


#2

You were using relative path ‘./tmp’.
From my understanding, it should be replaced with absolute path ‘/tmp’ as stated on the Docs.