Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Especificar etiquetas usando el encabezado de solicitud de etiquetado x-amz

Tengo un programa Node para cargar archivos en aws s3, necesito especificar el etiquetado x-amz con el encabezado de la solicitud. Intenté algo pero no funciona!

 function buildRequestHeader() { return { 'Content-Length': fileBuffer.size, 'Content-Type': mimeType, 'x-amz-acl': 'public-read', 'x-amz-tagging' :{"tag1":'abcd',"tag2":'efgh'} } }

He visto algo de aws docs,

 PUT object-key?tagging HTTP/1.1 Host: examplebucket.s3.amazonaws.com Content-Length: length Content-MD5: pUNXr/BjKK5G2UKExample== x-amz-date: 20160923T001956Z Authorization: authorization string <Tagging> <TagSet> <Tag> <Key>tag1</Key> <Value>val1</Value> </Tag> <Tag> <Key>tag2</Key> <Value>val2</Value> </Tag> </TagSet> </Tagging>

¿Podría explicar cómo funciona?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Los fragmentos de código que muestra son de dos métodos diferentes de etiquetado, el primero durante la creación de objetos , el segundo esagregar etiquetas a un objeto existente .

El encabezado x-amz-tagging es lo que usaría durante la creación de objetos, pero usa una sintaxis diferente a la de su ejemplo. Prueba esto en su lugar:

 function buildRequestHeader() { return { 'Content-Length': fileBuffer.size, 'Content-Type': mimeType, 'x-amz-acl': 'public-read', 'x-amz-tagging': 'tag1=abcd&tag2=efgh' } }
about 4 years ago · Santiago Trujillo Report

0

 const fs= require('fs'); const AWS = require('aws-sdk'); const s3 = new AWS.S3({'accesskey':'accesskeyvalue','region':'your s3 region'}) s3.upload( { Bucket: bucket_name, Key: key, Tagging: 'tag1=abcd&tag2=efgh', Body: fs.createReadStream('./filename.filetype'), }

¡Este método también está funcionando!

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!