JavaScript Getting BYTEA from PostgreSQL in Sails.js getting bytes from file java,getting bytes from string c#,

I have a problem in dealing with PostgreSQL BYTEA type in Sails.js.

Table definition (yes it is odd to create binary PK, but some_data is always small):

CREATE TABLE data_blobs (
  some_data BYTEA PRIMARY KEY,
  my_date_time TIMESTAMP WITH TIME ZONE NOT NULL);

Model configuration looks like this:

module.exports = {
  tableName: 'data_blobs',
  autoCreatedAt: false,
  autoUpdatedAt: false,
  autoPK: false,
  attributes: {
    some_data: {
      type: 'binary',
      primaryKey: true
    },
    my_date_time: 'datetime',
};

When I query table from node.js using node-postgres (pg) the result contains Node Buffer with some_data which is very easy to use.

But when I query table from Sails.js using code like this one:

DataBlobs.find().then(function(result){
  console.log('Result: ');
  console.log(result);
});

The result looks this way:

{
  some_data: 
  { '0': 1,
    '1': 79,
    '2': 95,
    ...
    '19': 216,
    length: 20,
    parent: 
    { '0': 47,
      ...
      '8191': 0 }
  },
  my_date_time: '2015-08-24T10:43:11.959Z'
}

It seems to me that Waterline transforms Node Buffer to something strange and quite useless (without additional transformation). I could not find any documentation about data conversion not in Waterline docs and not in sails-postgresql docs.

I see two options to deal with this situation:

  1. Somehow to prevent Waterline from converting Buffer and to do conversion on my own.
  2. To grab Waterline output and convert it in controllers.

Second option seems less effective because the original data is appended with large 'parent' and there would be two conversions Buffer->Waterline->MyFormat instead of simple Buffer->MyFormat.

Answer:1

I'm using fetch API to call query the server in my React Native Application. But, My application taking 50 seconds to call then function after receiving the response from the server. Am I doing any ...

I'm using fetch API to call query the server in my React Native Application. But, My application taking 50 seconds to call then function after receiving the response from the server. Am I doing any ...

  1. taking much time
  2. taking too much time off work
  3. taking too much time synonym
  4. taking too much time
  5. taking too much time to boot
  6. taking so much time
  7. taking too much time to poop
  8. without taking much time
  9. taking too much time to shut down
  10. taking too much time off
  11. taking too much time to build gradle
  12. taking to much time off work
  13. taking too much time off work when pregnant
  14. gridview taking much time to load
  15. not taking much time
  16. taking too much time to die...no mercy
  17. taking too much time to create apple id
  18. taking too much time to eat
  19. not taking much time synonym
  20. taking too much time in decision making

I have a task that has a few rules. Basically, I am separating a number into groups of 3. If the last group only has 1 digit in it, then the last 2 groups have 2 digits instead of 1 group of 3 and 1 ...

I have a task that has a few rules. Basically, I am separating a number into groups of 3. If the last group only has 1 digit in it, then the last 2 groups have 2 digits instead of 1 group of 3 and 1 ...

  1. javascript regex conditional replace
  2. javascript regex conditional group
  3. javascript regex conditional
  4. javascript regex conditional match
  5. javascript regex conditional operator
  6. javascript regex conditional statement
  7. js regex conditional

I am trying to authenticate a user using the Basic Authentication protocol in Jquery but it keeps giving error:"XMLHttpRequest cannot load https://api.credly.com/v1.1/authenticate. Request header ...

I am trying to authenticate a user using the Basic Authentication protocol in Jquery but it keeps giving error:"XMLHttpRequest cannot load https://api.credly.com/v1.1/authenticate. Request header ...

  1. basic auth work
  2. basic auth not working in postman
  3. basic auth not working
  4. basic auth not working apache
  5. basic auth not working kubernetes
  6. basic auth doesn't work
  7. basic auth header not working
  8. auth basic not working nginx
  9. basic auth post not working
  10. traefik basic auth not working
  11. axios basic auth not working
  12. htaccess basic auth not working
  13. auth_basic off not working
  14. apache2 basic auth not working
  15. basic auth in url not working
  16. curl basic auth not working
  17. express-basic-auth not working
  18. grafana basic auth not working
  19. swagger basic auth not working
  20. flask basic auth not working

I was wondering if there is a better way to do this: var books = [ { title: 'Some Book', author: { firstName: 'John', lastName: 'Doe' } }, { title: ...

I was wondering if there is a better way to do this: var books = [ { title: 'Some Book', author: { firstName: 'John', lastName: 'Doe' } }, { title: ...