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

221
Views
how to include multiple yaml configuration in the same file using js-yaml

am working on a project that include generating yaml files and am using js-yaml and it did help me so far but the problem is that the library work this way

  const yaml = require('js-yaml');

  const kyaml = {
    apiVersion: 'v1',
    kind: 'Namespace',
    metadata: {
      name: username,
    },
  };

  await writeFile(
    `tenant.yaml`,
    yaml.dump(kyaml),
    'utf8',
  );

and that will produce

apiVersion: v1
kind: Namespace
metadata:
  name: sara

now my probelm that i need to generate file that have multiple configs separted with triple dashes like this

apiVersion: v1
kind: Namespace
metadata:
  name: sara
---
apiVersion: v1
kind: Namespace
metadata:
  name: joe

so far i did search for some help to achieve that and i didnt find any so any help here is apriciated

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

js-yaml specifically decided not to support that. They give this workaround:

[docs_to_dump].map(doc => yaml.safeDump(doc)).join('---\n');
about 4 years ago · Juan Pablo Isaza 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!