       @_createFolder userhome ".mapscii"
       @_createFolder userhome ".mapscii", "cache"
     catch error
-      @config.persistDownloadedTiles = false
+      config.persistDownloadedTiles = false
       return
 
   _persistTile: (z, x, y, buffer) ->

  null

module.exports = class TileSource
  config:
    persistDownloadedTiles: true

  cache: {}
  modes:
    MBTiles: 1


  _getHTTP: (z, x, y) ->
    promise =
      if config.persistDownloadedTiles and tile = @_getPersited z, x, y
        Promise.resolve tile
      else
        rp
          uri: @source+[z,x,y].join("/")+".pbf"
          encoding: null
        .then (buffer) =>
          @_persistTile z, x, y, buffer if config.persistDownloadedTiles
          buffer

    promise
