Tardigrade for typescript/nodejs

Hello, I’ve tested the general functionality via CLI of tardigrade. Very stoked this is finally available.

I’m building an app that has two pieces:

  • go server
  • typescript frontend

Testing the current nodejs lib with bindings to C (https://github.com/utropicmedia/storj-nodejs) didn’t work locally on a mac.
I began working on my own bindings, but seems the C lib requires heavy compiling, and I’m not a fan of building yet more things reliant on node-gyp / C bindings.

Two questions:

  1. Is there a lib coming that has better functionality for typescript?
  2. If no, or if it will be a while – is there an API of sorts that would allow non-C-bindings connecting directly to tardigrade?

If these questions are misguided, I’d love to be directed to better docs or suggestions.



Hi @TrevorJTClarke -

First - what issue did you run into on a mac? (Also, thanks for posting!)

Second - we’re in-flight on a 1.0-compatible version of the nodejs bindings, targeting the end of the week for release. The bindings are downstream from the c library for a few reasons:

  • Complexity: libuplink does a LOT of work. Rewriting it doesn’t make sense
  • Maintainability: having loosely-coupled bindings increases maintenance overhead drastically
  • Performance: the C routines are generally smaller

If you want to connect to Tardigrade without the dependency I would suggest looking at the S3 gateway approach - check out https://documentation.tardigrade.io/api-reference/s3-gateway and then https://github.com/minio/minio-js for reference


Thanks for the fast reply!

I’ll take a look at those libs and consider it.

For debugging, i did a fresh install for both node repo and go. Here’s the steps I took with comments:

  1. Testing the install with npm i without bothering to do go package setup:
    returns error needing storj/lib/uplinkc
    It requires local building of libuplinkc with GO, any way to package a binary?
    this command: (cd $HOME/go/src/storj.io/storj/lib/uplinkc && go build -o libuplinkc.so -buildmode=c-shared ) && cp $HOME/go/src/storj.io/storj/lib/uplinkc/libuplinkc.* ./ && cp $HOME/go/src/storj.io/storj/lib/uplinkc/uplink_definitions.h ./ && node-gyp configure && node-gyp rebuild
  • installing with go, i get:
    package github.com/spacemonkeygo/monkit/v3: code in directory /Users/me/go/src/github.com/spacemonkeygo/monkit expects import "github.com/spacemonkeygo/monkit/v3"
    otherwise, no issues

  • going back to install storj-nodejs (only using the repo, not imported to project)
    ../../../common/macaroon/apikey.go:13:2: code in directory /Users/me/go/src/github.com/spacemonkeygo/monkit expects import "github.com/spacemonkeygo/monkit/v3"
    This is where it fails.

Hopefully this is a simple fix?

Node: v12.13.1
npm: 6.12.1
go: go1.12.7 darwin/amd64

1 Like

@utropicmedia-karl Any updates on this?
I saw there were some updates to the main uplink repo and the nodejs lib. I tried again with recent versions using go 1.13.3, but still get issues mentioned above. Seems others are having similar issues: Error while go get storj.io/storj/lib/uplink

Is this a problem with my setup, or is this a known bug?

@TrevorJTClarke - there is a known bug in the build process. The issue is that you need to now clone the uplinkc repo (git clone https://github.com/storj/uplink-c) and build the .so file from that clone to use with the binding. We’re aware of the build issue and are working on a fix for next week.

If you want to use prior to the build update you can just clone the above repo into your GOPATH and re-run npm install on the bindings.


@utropicmedia-karl thanks, ill try that!

1 Like

@utropicmedia-karl attempted to do the build with go 1.14.2:

make build
go build -ldflags="-s -w" -buildmode c-shared -o .build/uplink.so .
# runtime/cgo
In file included from gcc_libinit.c:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:232:66: error: unknown type name 'size_t'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:249:43: error: unknown type name 'size_t'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:256:66: error: unknown type name 'size_t'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:524:1: error: unknown type name 'size_t'
gcc_libinit.c:97:18: error: variable has incomplete type 'struct timespec'
gcc_libinit.c:97:9: note: forward declaration of 'struct timespec'
gcc_libinit.c:110:3: error: implicit declaration of function 'nanosleep' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
make: *** [build] Error 2

Will the next week release be the uplink or uplink-c? or both?