W3C home > Mailing lists > Public > public-rww@w3.org > June 2014

Re: uploading to data.fm / rww.io from nodejs

From: Melvin Carvalho <melvincarvalho@gmail.com>
Date: Fri, 6 Jun 2014 12:35:58 +0200
Message-ID: <CAKaEYhLFz+wfjoMQKw8EOBzZgKtZfn12csA+YGLKVD6WBzibGA@mail.gmail.com>
To: Joe <presbrey@gmail.com>
Cc: cr <_@whats-your.name>, "public-rww@w3.org" <public-rww@w3.org>
On 29 March 2014 19:21, Joe <presbrey@gmail.com> wrote:

> Sorry about that, I just added a patch that should take care of the issue
> specific to node.js and chunked uploads. Can you please try again?
>


This is working really well for me now, here's the code:


var https = require('https');
var fs = require("fs");

var options = {
    host: '*domain_name*',
    port: 443,
    path: '*path_to_file*',
    method: 'PUT',
    key: fs.readFileSync("*path_to_key.key*"),
    cert: fs.readFileSync("*path_to_cert.crt*"),
    headers: { 'content-type': 'text/turtle' }
};

var req = https.request(options, function(res) {
    console.log("statusCode: ", res.statusCode);
    console.log("headers: ", res.headers);

    res.on('data', function(d) {
        process.stdout.write(d);
      });
});


req.write('*<> <> <> .*');
req.end();

req.on('error', function(e) {
    console.error(e);
});


>
> Best wishes,
>
>
> On Fri, Mar 28, 2014 at 9:23 AM, Andrei Sambra <andrei.sambra@gmail.com>
> wrote:
>
>> Hi,
>>
>>
>> On Fri, Mar 28, 2014 at 4:08 AM, cr <_@whats-your.name> wrote:
>>
>>> i got a trifecta of Error 400s on each app i tried to write to a data.fm
>>> account from last week - LD-cal, kima, and cimba. just as another
>>> data-point.
>>>
>>> no idea what i'm doing, especially <
>>> http://www.w3.org/ns/pim/space#storage> i guess the object of this
>>> triple should be a directory/ and not a file.ttl, and what happens if it
>>> expected that path to not be a dirname but a virtual extension-free prefix
>>> of a filename (in Stample's case, apparently a symlink) but a dir was there
>>> - POSIX fun all over again ?
>>>
>>
>> While the vocabulary does not specifically say that space#storage should
>> be a directory, I believe it to be a fairly straightforward notion
>> describing a collection of resources. The fact that it really is a POSIX
>> directory should not matter, as long as the web server handles request for
>> that space.
>>
>>
>>>
>>> also, the links Melvin posted (on cc.data.fm) returned 500 or maybe 403
>>> until i presented a valid webID cert - i guess "having a valid WebID" may
>>> be a requisite to reading them, but since theyre docs that would hopefully
>>> suck in new users, or crawlers, maybe that shouldn't be the case.
>>>
>>
>> Are you sure it was a 403? In that case, perhaps you don't have
>> sufficient permissions to access the resource. Do not expect everything on
>> the web to be public.
>>
>>
>>>
>>> also the server my FOAF file's on is going to throw a cert-error until i
>>> find a domain-name i like and buy a certficiate..
>>>
>>
>> I don't really understand what you mean.
>>
>> -- Andrei
>>
>>
>
Received on Friday, 6 June 2014 10:36:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:10:46 UTC