Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

223
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda